| 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 1ed077da32f754dbdefa76b2a66c7b3bbd76fb52..f4d001a9ff413161d7f0f0b7a0fb596c6516e8d8 100644
|
| --- a/pkg/compiler/lib/src/js_backend/backend.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/backend.dart
|
| @@ -577,6 +577,9 @@ class JavaScriptBackend extends Backend {
|
| /// constructors for custom elements.
|
| CustomElementsAnalysis customElementsAnalysis;
|
|
|
| + /// Support for classifying `noSuchMethod` implementations.
|
| + NoSuchMethodRegistry noSuchMethodRegistry;
|
| +
|
| JavaScriptConstantTask constantCompilerTask;
|
|
|
| JavaScriptResolutionCallbacks resolutionCallbacks;
|
| @@ -585,6 +588,8 @@ class JavaScriptBackend extends Backend {
|
|
|
| bool get canHandleCompilationFailed => true;
|
|
|
| + bool enabledNoSuchMethod = false;
|
| +
|
| JavaScriptBackend(Compiler compiler, bool generateSourceMap)
|
| : namer = determineNamer(compiler),
|
| oneShotInterceptors = new Map<String, Selector>(),
|
| @@ -595,6 +600,7 @@ class JavaScriptBackend extends Backend {
|
| emitter = new CodeEmitterTask(compiler, namer, generateSourceMap);
|
| typeVariableHandler = new TypeVariableHandler(this);
|
| customElementsAnalysis = new CustomElementsAnalysis(this);
|
| + noSuchMethodRegistry = new NoSuchMethodRegistry(this);
|
| constantCompilerTask = new JavaScriptConstantTask(compiler);
|
| resolutionCallbacks = new JavaScriptResolutionCallbacks(this);
|
| patchResolverTask = new PatchResolverTask(compiler);
|
| @@ -1198,11 +1204,13 @@ class JavaScriptBackend extends Backend {
|
| enqueueClass(compiler.enqueuer.resolution, compiler.stringClass, registry);
|
| }
|
|
|
| - void enableNoSuchMethod(Element context, Enqueuer world) {
|
| + void registerNoSuchMethod(Element noSuchMethod) {
|
| + noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod);
|
| + }
|
| +
|
| + void enableNoSuchMethod(Enqueuer world) {
|
| enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies);
|
| world.registerInvocation(compiler.noSuchMethodSelector);
|
| - // TODO(tyoverby): Send the context element to DumpInfoTask to be
|
| - // blamed.
|
| }
|
|
|
| void enableIsolateSupport(Enqueuer enqueuer) {
|
| @@ -2391,6 +2399,14 @@ class JavaScriptBackend extends Backend {
|
| customElementsAnalysis.onQueueEmpty(enqueuer);
|
| if (!enqueuer.queueIsEmpty) return false;
|
|
|
| + noSuchMethodRegistry.onQueueEmpty();
|
| + if (!enabledNoSuchMethod &&
|
| + (noSuchMethodRegistry.hasThrowingNoSuchMethod ||
|
| + noSuchMethodRegistry.hasComplexNoSuchMethod)) {
|
| + enableNoSuchMethod(enqueuer);
|
| + enabledNoSuchMethod = true;
|
| + }
|
| +
|
| if (compiler.hasIncrementalSupport) {
|
| // Always enable tear-off closures during incremental compilation.
|
| Element e = findHelper('closureFromTearOff');
|
|
|