[ddc] Cleanup old setBaseClass()
With the new type system type arguments appearing in extends are no longer represented by a class definition and do not need to trigger any lazy logic. Change-Id: I3f80f9f972bec69c678909c12d25a604a8fe2c59 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353205 Commit-Queue: Nicholas Shahan <nshahan@google.com> Reviewed-by: Mark Zhou <markzipan@google.com>
This commit is contained in:
committed by
Commit Queue
parent
e12b3d0ee5
commit
061004f83f
@@ -1265,19 +1265,9 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
||||
_classEmittingExtends = c;
|
||||
|
||||
// Unroll mixins.
|
||||
if (shouldDefer(supertype)) {
|
||||
var originalSupertype = supertype;
|
||||
deferredSupertypes.add(() => runtimeStatement('setBaseClass(#, #)', [
|
||||
getBaseClass(mixinApplications.length),
|
||||
emitDeferredClassRef(originalSupertype),
|
||||
]));
|
||||
// Refers to 'supertype' without type parameters. We remove these from
|
||||
// the 'extends' clause for generics for cyclic dependencies and append
|
||||
// them later with 'setBaseClass'.
|
||||
supertype =
|
||||
_coreTypes.rawType(supertype.classNode, _currentLibrary!.nonNullable);
|
||||
}
|
||||
var baseClass = emitClassRef(supertype);
|
||||
var baseClass = shouldDefer(supertype)
|
||||
? emitDeferredClassRef(supertype)
|
||||
: emitClassRef(supertype);
|
||||
|
||||
// TODO(jmesserly): we need to unroll kernel mixins because the synthetic
|
||||
// classes lack required synthetic members, such as constructors.
|
||||
|
||||
@@ -531,15 +531,9 @@ definePrimitiveHashCode(proto) {
|
||||
getOwnPropertyDescriptor(proto, extensionSymbol('hashCode')));
|
||||
}
|
||||
|
||||
/// Link the extension to the type it's extending as a base class.
|
||||
void setBaseClass(@notNull Object derived, @notNull Object base) {
|
||||
jsObjectSetPrototypeOf(
|
||||
JS('', '#.prototype', derived), JS('', '#.prototype', base));
|
||||
// We use __proto__ to track the superclass hierarchy (see isSubtypeOf).
|
||||
jsObjectSetPrototypeOf(derived, base);
|
||||
}
|
||||
|
||||
/// Like [setBaseClass], but for generic extension types such as `JSArray<E>`.
|
||||
/// Link the [dartType] to the native [jsType] it is extending as a base class.
|
||||
///
|
||||
/// Used for generic extension types such as `JSArray<E>`.
|
||||
void setExtensionBaseClass(@notNull Object dartType, @notNull Object jsType) {
|
||||
// Mark the generic type as an extension type and link the prototype objects.
|
||||
var dartProto = JS<Object>('!', '#.prototype', dartType);
|
||||
|
||||
Reference in New Issue
Block a user