Chromium Code Reviews| 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..4d63e182f1ddaff613f978c8aca5b04c77dca214 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, |
| + LibraryLoader loader) { |
| + // 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(loader, 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 |
| @@ -750,7 +761,7 @@ abstract class Compiler implements DiagnosticListener { |
| DietParserTask dietParser; |
| ParserTask parser; |
| PatchParserTask patchParser; |
| - LibraryLoader libraryLoader; |
| + LibraryLoaderTask libraryLoader; |
| TreeValidatorTask validator; |
| ResolverTask resolver; |
| closureMapping.ClosureTask closureToClassMapper; |
| @@ -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 |
|
floitsch
2014/06/24 09:01:54
s/callback/loader/
Johnni Winther
2014/06/24 09:12:58
Done.
|
| + /// for [library]. |
| + Future onLibraryScanned(LibraryElement library, |
| + LibraryLoader loader) { |
|
floitsch
2014/06/24 09:01:54
might fit on one line now?
Johnni Winther
2014/06/24 09:12:58
Done.
|
| 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, loader); |
| } |
| /// This method is called when all new libraries loaded through |