| Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| index 717366b078af31b859d1cf1051cb0de61358ebac..db1363161dda6ab367267afc5f744148d287bfda 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| @@ -675,7 +675,7 @@ class JavaScriptBackend extends Backend {
|
| registerInstantiatedConstantType(interceptor.dispatchedType, registry);
|
| } else if (constant.isType) {
|
| TypeConstant typeConstant = constant;
|
| - registerTypeLiteral(typeConstant.representedType.element,
|
| + registerTypeLiteral(typeConstant.representedType,
|
| compiler.enqueuer.codegen, registry);
|
| }
|
| }
|
| @@ -683,17 +683,18 @@ class JavaScriptBackend extends Backend {
|
| void registerInstantiatedConstantType(DartType type, Registry registry) {
|
| Enqueuer enqueuer = compiler.enqueuer.codegen;
|
| DartType instantiatedType =
|
| - type.kind == TypeKind.FUNCTION ? compiler.functionClass.rawType : type;
|
| - enqueuer.registerInstantiatedType(instantiatedType, registry);
|
| - if (type is InterfaceType && !type.treatAsRaw &&
|
| - classNeedsRti(type.element)) {
|
| - enqueuer.registerStaticUse(getSetRuntimeTypeInfo());
|
| - }
|
| - if (type.element == typeImplementation) {
|
| - // If we use a type literal in a constant, the compile time
|
| - // constant emitter will generate a call to the createRuntimeType
|
| - // helper so we register a use of that.
|
| - enqueuer.registerStaticUse(getCreateRuntimeType());
|
| + type.isFunctionType ? compiler.functionClass.rawType : type;
|
| + if (type is InterfaceType) {
|
| + enqueuer.registerInstantiatedType(instantiatedType, registry);
|
| + if (!type.treatAsRaw && classNeedsRti(type.element)) {
|
| + enqueuer.registerStaticUse(getSetRuntimeTypeInfo());
|
| + }
|
| + if (type.element == typeImplementation) {
|
| + // If we use a type literal in a constant, the compile time
|
| + // constant emitter will generate a call to the createRuntimeType
|
| + // helper so we register a use of that.
|
| + enqueuer.registerStaticUse(getCreateRuntimeType());
|
| + }
|
| }
|
| }
|
|
|
| @@ -892,7 +893,7 @@ class JavaScriptBackend extends Backend {
|
| enqueueInResolution(getCyclicThrowHelper(), registry);
|
| }
|
|
|
| - void registerTypeLiteral(Element element,
|
| + void registerTypeLiteral(DartType type,
|
| Enqueuer enqueuer,
|
| Registry registry) {
|
| enqueuer.registerInstantiatedClass(typeImplementation, registry);
|
| @@ -900,10 +901,10 @@ class JavaScriptBackend extends Backend {
|
| // TODO(ahe): Might want to register [element] as an instantiated class
|
| // when reflection is used. However, as long as we disable tree-shaking
|
| // eagerly it doesn't matter.
|
| - if (element.isTypedef) {
|
| - typedefTypeLiterals.add(element);
|
| + if (type.isTypedef) {
|
| + typedefTypeLiterals.add(type.element);
|
| }
|
| - customElementsAnalysis.registerTypeLiteral(element, enqueuer);
|
| + customElementsAnalysis.registerTypeLiteral(type, enqueuer);
|
| }
|
|
|
| void registerStackTraceInCatch(Registry registry) {
|
| @@ -982,8 +983,8 @@ class JavaScriptBackend extends Backend {
|
| }
|
| }
|
| }
|
| - bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE;
|
| - if (type.kind == TypeKind.MALFORMED_TYPE) {
|
| + bool isTypeVariable = type.isTypeVariable;
|
| + if (type.isMalformed) {
|
| enqueueInResolution(getThrowTypeError(), registry);
|
| }
|
| if (!type.treatAsRaw || type.containsTypeVariables) {
|
| @@ -1307,7 +1308,7 @@ class JavaScriptBackend extends Backend {
|
| {bool typeCast,
|
| bool nativeCheckOnly}) {
|
| assert(type.kind != TypeKind.TYPEDEF);
|
| - if (type.kind == TypeKind.MALFORMED_TYPE) {
|
| + if (type.isMalformed) {
|
| // The same error is thrown for type test and type cast of a malformed
|
| // type so we only need one check method.
|
| return 'checkMalformedType';
|
| @@ -1390,15 +1391,15 @@ class JavaScriptBackend extends Backend {
|
| : 'listSuperTypeCheck';
|
| }
|
| } else {
|
| - if (type.kind == TypeKind.INTERFACE && !type.treatAsRaw) {
|
| + if (type.isInterfaceType && !type.treatAsRaw) {
|
| return typeCast
|
| ? 'subtypeCast'
|
| : 'assertSubtype';
|
| - } else if (type.kind == TypeKind.TYPE_VARIABLE) {
|
| + } else if (type.isTypeVariable) {
|
| return typeCast
|
| ? 'subtypeOfRuntimeTypeCast'
|
| : 'assertSubtypeOfRuntimeType';
|
| - } else if (type.kind == TypeKind.FUNCTION) {
|
| + } else if (type.isFunctionType) {
|
| return null;
|
| } else {
|
| if (nativeCheck) {
|
|
|