| Index: sdk/lib/_internal/compiler/implementation/compiler.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
|
| index df957bf04259007b225cfecf60bbcf033abe6ecc..e28c6449234b94231f859b79f793b0a9b7898aaf 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/compiler.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
|
| @@ -403,7 +403,18 @@ abstract class Backend {
|
|
|
| /// This method is called immediately after the [library] and its parts have
|
| /// been scanned.
|
| - void onLibraryScanned(LibraryElement library) {}
|
| + Future onLibraryScanned(LibraryElement library,
|
| + LibraryLoaderCallback callback) {
|
| + // TODO(johnniwinther): Move this to the JavaScript backend.
|
| + if (library.isPlatformLibrary && !library.isPatched) {
|
| + // Apply patch, if any.
|
| + Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path);
|
| + if (patchUri != null) {
|
| + return compiler.patchParser.patchLibrary(callback, patchUri, library);
|
| + }
|
| + }
|
| + return new Future.value();
|
| + }
|
|
|
| /// This method is called when all new libraries loaded through
|
| /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports
|
| @@ -1051,7 +1062,11 @@ abstract class Compiler implements DiagnosticListener {
|
| /// Use this callback method to store references to specific member declared
|
| /// in certain libraries. Note that [library] has not been patched yet, nor
|
| /// has its imports/exports been resolved.
|
| - void onLibraryScanned(LibraryElement library) {
|
| + ///
|
| + /// Use [callback] to register the creation and scanning of a patch library
|
| + /// for [library].
|
| + Future onLibraryScanned(LibraryElement library,
|
| + LibraryLoaderCallback callback) {
|
| Uri uri = library.canonicalUri;
|
| if (uri == DART_CORE) {
|
| initializeCoreClasses();
|
| @@ -1069,7 +1084,7 @@ abstract class Compiler implements DiagnosticListener {
|
| } else if (uri == DART_NATIVE_TYPED_DATA) {
|
| typedDataClass = findRequiredElement(library, 'NativeTypedData');
|
| }
|
| - backend.onLibraryScanned(library);
|
| + return backend.onLibraryScanned(library, callback);
|
| }
|
|
|
| /// This method is called when all new libraries loaded through
|
|
|