| 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 d4585d54373e2bc025277122f4076b8ed1f6117c..7d1859de6c7d8d1a8e6445d4ef45a5da3e0cce57 100644
|
| --- a/pkg/compiler/lib/src/js_backend/backend.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/backend.dart
|
| @@ -340,6 +340,7 @@ class JavaScriptBackend extends Backend {
|
| List<CompilerTask> get tasks {
|
| List<CompilerTask> result = functionCompiler.tasks;
|
| result.add(emitter);
|
| + result.add(patchResolverTask);
|
| return result;
|
| }
|
|
|
| @@ -447,6 +448,8 @@ class JavaScriptBackend extends Backend {
|
|
|
| JavaScriptResolutionCallbacks resolutionCallbacks;
|
|
|
| + PatchResolverTask patchResolverTask;
|
| +
|
| JavaScriptBackend(Compiler compiler, bool generateSourceMap)
|
| : namer = determineNamer(compiler),
|
| oneShotInterceptors = new Map<String, Selector>(),
|
| @@ -459,6 +462,7 @@ class JavaScriptBackend extends Backend {
|
| customElementsAnalysis = new CustomElementsAnalysis(this);
|
| constantCompilerTask = new JavaScriptConstantTask(compiler);
|
| resolutionCallbacks = new JavaScriptResolutionCallbacks(this);
|
| + patchResolverTask = new PatchResolverTask(compiler);
|
| functionCompiler = USE_CPS_IR
|
| ? new CspFunctionCompiler(compiler, this)
|
| : new SsaFunctionCompiler(this, generateSourceMap);
|
| @@ -472,6 +476,12 @@ class JavaScriptBackend extends Backend {
|
| return constantCompilerTask.jsConstantCompiler;
|
| }
|
|
|
| + FunctionElement resolveExternalFunction(FunctionElement element) {
|
| + return patchResolverTask.measure(() {
|
| + return patchResolverTask.resolveExternalFunction(element);
|
| + });
|
| + }
|
| +
|
| // TODO(karlklose): Split into findHelperFunction and findHelperClass and
|
| // add a check that the element has the expected kind.
|
| Element findHelper(String name) => find(jsHelperLibrary, name);
|
| @@ -1697,6 +1707,14 @@ class JavaScriptBackend extends Backend {
|
|
|
| Future onLibraryScanned(LibraryElement library, LibraryLoader loader) {
|
| return super.onLibraryScanned(library, loader).then((_) {
|
| + if (library.isPlatformLibrary && !library.isPatched) {
|
| + // Apply patch, if any.
|
| + Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path);
|
| + if (patchUri != null) {
|
| + return compiler.patchParser.patchLibrary(loader, patchUri, library);
|
| + }
|
| + }
|
| + }).then((_) {
|
| Uri uri = library.canonicalUri;
|
|
|
| VariableElement findVariable(String name) {
|
|
|