| 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 36bdbc2e74b25c6419370190100e00cbcbbf6d80..c3052f44edd40502cd36be7be004cfadd33bb2ea 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| @@ -1229,26 +1229,19 @@ class JavaScriptBackend extends Backend {
|
| void registerIsCheck(DartType type, Enqueuer world, TreeElements elements) {
|
| world.registerInstantiatedClass(compiler.boolClass, elements);
|
| bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE;
|
| - bool inCheckedMode = compiler.enableTypeAssertions;
|
| if (!type.isRaw || isTypeVariable) {
|
| enqueueInResolution(getSetRuntimeTypeInfo(), elements);
|
| enqueueInResolution(getGetRuntimeTypeInfo(), elements);
|
| enqueueInResolution(getGetRuntimeTypeArgument(), elements);
|
| - if (inCheckedMode) {
|
| - enqueueInResolution(getAssertSubtype(), elements);
|
| - }
|
| enqueueInResolution(getCheckSubtype(), elements);
|
| if (isTypeVariable) {
|
| - enqueueInResolution(getCheckSubtypeOfRuntimeType(), elements);
|
| - if (inCheckedMode) {
|
| - enqueueInResolution(getAssertSubtypeOfRuntimeType(), elements);
|
| - }
|
| + enqueueInResolution(getGetObjectIsSubtype(), elements);
|
| }
|
| world.registerInstantiatedClass(compiler.listClass, elements);
|
| }
|
| // [registerIsCheck] is also called for checked mode checks, so we
|
| // need to register checked mode helpers.
|
| - if (inCheckedMode) {
|
| + if (compiler.enableTypeAssertions) {
|
| Element e = getCheckedModeHelper(type, typeCast: false);
|
| if (e != null) world.addToWorkList(e);
|
| // We also need the native variant of the check (for DOM types).
|
| @@ -1334,8 +1327,8 @@ class JavaScriptBackend extends Backend {
|
| }
|
|
|
| bool needsRti(ClassElement cls) {
|
| - return rti.classesNeedingRti.contains(cls.declaration) ||
|
| - compiler.enabledRuntimeType;
|
| + return rti.classesNeedingRti.contains(cls.declaration)
|
| + || compiler.enabledRuntimeType;
|
| }
|
|
|
| bool isDefaultNoSuchMethodImplementation(Element element) {
|
| @@ -1600,9 +1593,8 @@ class JavaScriptBackend extends Backend {
|
| * backend with implementation types (JSInt, JSString, ...).
|
| */
|
| Element getCheckedModeHelper(DartType type, {bool typeCast}) {
|
| - SourceString name = getCheckedModeHelperName(
|
| - type, typeCast: typeCast, nativeCheckOnly: false);
|
| - return compiler.findHelper(name);
|
| + return compiler.findHelper(getCheckedModeHelperName(
|
| + type, typeCast: typeCast, nativeCheckOnly: false));
|
| }
|
|
|
| /**
|
| @@ -1701,22 +1693,13 @@ class JavaScriptBackend extends Backend {
|
| }
|
| } else {
|
| if (nativeCheck) {
|
| - // TODO(karlklose): can we get rid of this branch when we use
|
| - // interceptors?
|
| return typeCast
|
| ? const SourceString("interceptedTypeCast")
|
| : const SourceString('interceptedTypeCheck');
|
| } else {
|
| - if (typeCast) {
|
| - return const SourceString("propertyTypeCast");
|
| - }
|
| - if (type.kind == TypeKind.INTERFACE && !type.isRaw) {
|
| - return const SourceString('assertSubtype');
|
| - } else if (type.kind == TypeKind.TYPE_VARIABLE) {
|
| - return const SourceString('assertSubtypeOfRuntimeType');
|
| - } else {
|
| - return const SourceString('propertyTypeCheck');
|
| - }
|
| + return typeCast
|
| + ? const SourceString("propertyTypeCast")
|
| + : const SourceString('propertyTypeCheck');
|
| }
|
| }
|
| }
|
| @@ -1799,17 +1782,8 @@ class JavaScriptBackend extends Backend {
|
| return compiler.findHelper(const SourceString('checkSubtype'));
|
| }
|
|
|
| - Element getAssertSubtype() {
|
| - return compiler.findHelper(const SourceString('assertSubtype'));
|
| - }
|
| -
|
| - Element getCheckSubtypeOfRuntimeType() {
|
| - return compiler.findHelper(const SourceString('checkSubtypeOfRuntimeType'));
|
| - }
|
| -
|
| - Element getAssertSubtypeOfRuntimeType() {
|
| - return compiler.findHelper(
|
| - const SourceString('assertSubtypeOfRuntimeType'));
|
| + Element getGetObjectIsSubtype() {
|
| + return compiler.findHelper(const SourceString('objectIsSubtype'));
|
| }
|
|
|
| Element getThrowNoSuchMethod() {
|
|
|