| 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 ff254c9d16a06f3ac73183223177f15177a139dd..7bd99ee7525f6c2f48a2dd9ec2f0436ec362b645 100644
|
| --- a/pkg/compiler/lib/src/js_backend/backend.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/backend.dart
|
| @@ -1349,6 +1349,40 @@ class JavaScriptBackend extends Backend {
|
| noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod);
|
| }
|
|
|
| + /// Called when resolving a call to a foreign function.
|
| + void registerForeignCall(Send node,
|
| + Element element,
|
| + CallStructure callStructure,
|
| + ForeignResolver resolver) {
|
| + native.NativeResolutionEnqueuer nativeEnqueuer =
|
| + compiler.enqueuer.resolution.nativeEnqueuer;
|
| + if (element.name == 'JS') {
|
| + nativeEnqueuer.registerJsCall(node, resolver);
|
| + } else if (element.name == 'JS_EMBEDDED_GLOBAL') {
|
| + nativeEnqueuer.registerJsEmbeddedGlobalCall(node, resolver);
|
| + } else if (element.name == 'JS_BUILTIN') {
|
| + nativeEnqueuer.registerJsBuiltinCall(node, resolver);
|
| + } else if (element.name == 'JS_INTERCEPTOR_CONSTANT') {
|
| + // The type constant that is an argument to JS_INTERCEPTOR_CONSTANT names
|
| + // a class that will be instantiated outside the program by attaching a
|
| + // native class dispatch record referencing the interceptor.
|
| + if (!node.argumentsNode.isEmpty) {
|
| + Node argument = node.argumentsNode.nodes.head;
|
| + ConstantExpression constant = resolver.getConstant(argument);
|
| + if (constant != null && constant.kind == ConstantExpressionKind.TYPE) {
|
| + TypeConstantExpression typeConstant = constant;
|
| + if (typeConstant.type is InterfaceType) {
|
| + resolver.registerInstantiatedType(typeConstant.type);
|
| + return;
|
| + }
|
| + }
|
| + }
|
| + compiler.reportErrorMessage(
|
| + node,
|
| + MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
|
| + }
|
| + }
|
| +
|
| void enableNoSuchMethod(Enqueuer world) {
|
| enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies);
|
| world.registerInvocation(
|
|
|