| Index: lib/compiler/implementation/compiler.dart
|
| diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
|
| index bf51eb7a1c4a8ee12d839c316677aecbf2256d27..789d80926f404cd8c4ce6a38ce444ba1a79b1163 100644
|
| --- a/lib/compiler/implementation/compiler.dart
|
| +++ b/lib/compiler/implementation/compiler.dart
|
| @@ -358,51 +358,33 @@ class Compiler implements DiagnosticListener {
|
|
|
| initializeSpecialClasses();
|
|
|
| - patchDartLibrary(coreLibrary, 'core');
|
| - patchDartLibrary(coreImplLibrary, 'coreimpl');
|
| + //patchDartLibrary(coreLibrary, 'core');
|
| + //patchDartLibrary(coreImplLibrary, 'coreimpl');
|
| }
|
|
|
| void patchDartLibrary(LibraryElement library, String dartLibraryPath) {
|
| + print("[Patching; $library ($dartLibraryPath)");
|
| if (library.isPatched) return;
|
| Uri patchUri = resolvePatchUri(dartLibraryPath);
|
| if (patchUri !== null) {
|
| - LibraryElement patchLibrary =
|
| - patchParser.loadPatchLibrary(patchUri);
|
| + print("[... loading patch ...]");
|
| + patchParser.patchLibrary(patchUri, library);
|
| // We allow foreign functions in patched libraries.
|
| addForeignFunctions(library); // Is safe even if already added.
|
| - applyLibraryPatch(library, patchLibrary);
|
| + // TODO(lrn): Make this lazy.
|
| + applyClassPatches(library);
|
| }
|
| }
|
|
|
| - void applyLibraryPatch(LibraryElement original, LibraryElement patch) {
|
| - Link<Element> patches = patch.localMembers;
|
| - applyContainerPatch(original, patches);
|
| -
|
| - // Copy imports from patch to original library.
|
| - Map<String, LibraryElement> delayedPatches = <LibraryElement>{};
|
| - Uri patchBase = patch.uri;
|
| - for (ScriptTag tag in patch.tags.reverse()) {
|
| - if (tag.isImport()) {
|
| - StringNode argument = tag.argument;
|
| - Uri resolved = patchBase.resolve(argument.dartString.slowToString());
|
| - LibraryElement importedLibrary =
|
| - scanner.loadLibrary(resolved, argument);
|
| - scanner.importLibrary(original, importedLibrary, tag,
|
| - patch.entryCompilationUnit);
|
| - if (resolved.scheme == "dart") {
|
| - delayedPatches[resolved.path] = importedLibrary;
|
| + void applyClassPatches(LibraryElement library) {
|
| + for (Element element in library.localMembers) {
|
| + if (element.isClass()) {
|
| + ClassElement classElement = element;
|
| + if (classElement.isPatched) {
|
| + applyClassPatch(classElement, classElement.patch);
|
| }
|
| }
|
| }
|
| -
|
| - // Mark library as already patched.
|
| - original.patch = patch;
|
| -
|
| - // We patch imported libraries after marking the current library as
|
| - // patched, to avoid problems with cyclic dependencies.
|
| - delayedPatches.forEach((String path, LibraryElement importedLibrary) {
|
| - patchDartLibrary(importedLibrary, path);
|
| - });
|
| }
|
|
|
| void applyContainerPatch(ScopeContainerElement original,
|
| @@ -571,7 +553,7 @@ class Compiler implements DiagnosticListener {
|
|
|
| void runCompiler(Uri uri) {
|
| scanBuiltinLibraries();
|
| - mainApp = scanner.loadLibrary(uri, null);
|
| + mainApp = scanner.loadLibrary(uri, null, uri);
|
| final Element main = mainApp.find(MAIN);
|
| if (main === null) {
|
| reportFatalError('Could not find $MAIN', mainApp);
|
|
|