Chromium Code Reviews| 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 ce801a9b8414fb83ec11b204a952f63a9ed69dcb..d3670c2b43f8260284c3bf0f67a9917381b519aa 100644 |
| --- a/pkg/compiler/lib/src/js_backend/backend.dart |
| +++ b/pkg/compiler/lib/src/js_backend/backend.dart |
| @@ -233,6 +233,8 @@ class JavaScriptBackend extends Backend { |
| new Uri(scheme: 'dart', path: '_js_embedded_names'); |
| static final Uri DART_ISOLATE_HELPER = |
| new Uri(scheme: 'dart', path: '_isolate_helper'); |
| + static final Uri PACKAGE_JS = |
| + new Uri(scheme: 'package', path: 'js/js.dart'); |
| static const String INVOKE_ON = '_getCachedInvocation'; |
| static const String START_ROOT_ISOLATE = 'startRootIsolate'; |
| @@ -289,6 +291,7 @@ class JavaScriptBackend extends Backend { |
| ClassElement jsBoolClass; |
| ClassElement jsPlainJavaScriptObjectClass; |
| ClassElement jsUnknownJavaScriptObjectClass; |
| + ClassElement jsJavaScriptFunctionClass; |
| ClassElement jsIndexableClass; |
| ClassElement jsMutableIndexableClass; |
| @@ -326,6 +329,8 @@ class JavaScriptBackend extends Backend { |
| ClassElement forceInlineClass; |
| ClassElement irRepresentationClass; |
| + ClassElement jsAnnotationClass; |
| + |
| Element getInterceptorMethod; |
| ClassElement jsInvocationMirrorClass; |
| @@ -660,7 +665,7 @@ class JavaScriptBackend extends Backend { |
| } |
| FunctionElement resolveExternalFunction(FunctionElement element) { |
| - if (isForeign(element)) return element; |
| + if (isForeign(element) || element.isJsInterop) return element; |
| return patchResolverTask.measure(() { |
| return patchResolverTask.resolveExternalFunction(element); |
| }); |
| @@ -1039,6 +1044,7 @@ class JavaScriptBackend extends Backend { |
| enqueue(enqueuer, getNativeInterceptorMethod, registry); |
| enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies); |
| enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, registry); |
| + enqueueClass(enqueuer, jsJavaScriptFunctionClass, registry); |
| } else if (cls == mapLiteralClass) { |
| // For map literals, the dependency between the implementation class |
| // and [Map] is not visible, so we have to add it manually. |
| @@ -1119,6 +1125,8 @@ class JavaScriptBackend extends Backend { |
| addInterceptors(jsPlainJavaScriptObjectClass, enqueuer, registry); |
| } else if (cls == jsUnknownJavaScriptObjectClass) { |
| addInterceptors(jsUnknownJavaScriptObjectClass, enqueuer, registry); |
| + } else if (cls == jsJavaScriptFunctionClass) { |
| + addInterceptors(jsJavaScriptFunctionClass, enqueuer, registry); |
| } else if (Elements.isNativeOrExtendsNative(cls)) { |
| addInterceptorsForNativeClassMembers(cls, enqueuer); |
| } else if (cls == jsIndexingBehaviorInterface) { |
| @@ -1137,6 +1145,7 @@ class JavaScriptBackend extends Backend { |
| Registry registry = compiler.globalDependencies; |
| enqueue(enqueuer, getNativeInterceptorMethod, registry); |
| enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, registry); |
| + enqueueClass(enqueuer, jsJavaScriptFunctionClass, registry); |
| needToInitializeIsolateAffinityTag = true; |
| needToInitializeDispatchProperty = true; |
| } |
| @@ -1467,6 +1476,7 @@ class JavaScriptBackend extends Backend { |
| } |
| ClassElement defaultSuperclass(ClassElement element) { |
| + if (element.isJsInterop) return jsPlainJavaScriptObjectClass; |
|
sra1
2015/10/01 20:55:28
jsJavaScriptObjectClass
Jacob
2015/10/02 20:08:15
Done.
|
| // Native classes inherit from Interceptor. |
| return element.isNative ? jsInterceptorClass : compiler.objectClass; |
| } |
| @@ -2099,6 +2109,7 @@ class JavaScriptBackend extends Backend { |
| jsExtendableArrayClass = findClass('JSExtendableArray'); |
| jsUnmodifiableArrayClass = findClass('JSUnmodifiableArray'); |
| jsPlainJavaScriptObjectClass = findClass('PlainJavaScriptObject'); |
| + jsJavaScriptFunctionClass = findClass('JavaScriptFunction'); |
| jsUnknownJavaScriptObjectClass = findClass('UnknownJavaScriptObject'); |
| jsIndexableClass = findClass('JSIndexable'); |
| jsMutableIndexableClass = findClass('JSMutableIndexable'); |
| @@ -2133,6 +2144,8 @@ class JavaScriptBackend extends Backend { |
| jsBuiltinEnum = find(library, 'JsBuiltin'); |
| } else if (uri == Uris.dart_html) { |
| htmlLibraryIsLoaded = true; |
| + } else if (uri == PACKAGE_JS) { |
| + jsAnnotationClass = find(library, 'Js'); |
| } |
| annotations.onLibraryScanned(library); |
| }); |