Index: pkg/compiler/lib/src/js_backend/backend.dart |
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart |
index 6b1ebbda42d9a5281e474e3f1436017ed7dc2c2d..3cdcfdf2b283533920c7321dae14a518ea80eda4 100644 |
--- a/pkg/compiler/lib/src/js_backend/backend.dart |
+++ b/pkg/compiler/lib/src/js_backend/backend.dart |
@@ -1019,6 +1019,26 @@ class JavaScriptBackend extends Backend { |
}); |
} |
+ /// True if the given class is an internal class used for type inference |
+ /// and never exists at runtime. |
+ bool isCompileTimeOnlyClass(ClassElement class_) { |
+ return class_ == jsPositiveIntClass || |
+ class_ == jsUInt32Class || |
+ class_ == jsUInt31Class || |
+ class_ == jsFixedArrayClass || |
+ class_ == jsUnmodifiableArrayClass || |
+ class_ == jsMutableArrayClass || |
+ class_ == jsExtendableArrayClass; |
+ } |
+ |
+ /// Maps compile-time classes to their runtime class. The runtime class is |
+ /// always a superclass or the class itself. |
+ ClassElement getRuntimeClass(ClassElement class_) { |
+ if (class_.isSubclassOf(jsIntClass)) return jsIntClass; |
+ if (class_.isSubclassOf(jsArrayClass)) return jsArrayClass; |
+ return class_; |
+ } |
+ |
final Map<String, Set<ClassElement>> interceptedClassesCache = |
new Map<String, Set<ClassElement>>(); |
@@ -1035,6 +1055,7 @@ class JavaScriptBackend extends Backend { |
Set<ClassElement> result = new Set<ClassElement>(); |
for (Element element in intercepted) { |
ClassElement classElement = element.enclosingClass; |
+ if (isCompileTimeOnlyClass(classElement)) continue; |
if (isNativeOrExtendsNative(classElement) |
|| interceptedClasses.contains(classElement)) { |
result.add(classElement); |
@@ -3321,4 +3342,3 @@ class Dependency { |
const Dependency(this.constant, this.annotatedElement); |
} |
- |