Chromium Code Reviews| Index: lib/compiler/implementation/compiler.dart |
| diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart |
| index c0f70bac3a7f6ac3fc4c11034453cb956806460c..fd8425df9618d6f0170a22536d068f2d6ef79064 100644 |
| --- a/lib/compiler/implementation/compiler.dart |
| +++ b/lib/compiler/implementation/compiler.dart |
| @@ -269,7 +269,9 @@ class Compiler implements DiagnosticListener { |
| // do not have enough stack space. |
| throw; |
| } catch (var ex) { |
| - unhandledExceptionOnElement(element); |
| + try { |
| + unhandledExceptionOnElement(element); |
| + } catch (var doubleFault) {} |
|
Johnni Winther
2012/07/03 11:04:29
Move the ending } to a new line and insert a comme
Lasse Reichstein Nielsen
2012/07/03 13:01:03
Done.
|
| throw; |
| } finally { |
| _currentElement = old; |
| @@ -525,6 +527,10 @@ class Compiler implements DiagnosticListener { |
| } |
| void applyLibraryPatch(LibraryElement library, LibraryElement patch) { |
| + // We allow foreign functions in patched libraries. |
| + addForeignFunctions(library); // Is safe even if already added. |
| + |
| + // Copy/patch top-level elements. |
| Link<Element> patches = patch.topLevelElements; |
| while (!patches.isEmpty()) { |
| Element patchElement = patches.head; |
| @@ -548,7 +554,29 @@ class Compiler implements DiagnosticListener { |
| } |
| patches = patches.tail; |
| } |
| + |
| + // Copy imports. |
| + Map<String, LibraryElement> delayedPatches = <LibraryElement>{}; |
| + Uri base = patch.script.uri; |
| + for (ScriptTag tag in patch.tags.reverse()) { |
| + if (tag.isImport()) { |
| + StringNode argument = tag.argument; |
| + Uri resolved = base.resolve(argument.dartString.slowToString()); |
| + LibraryElement importedLibrary = |
| + scanner.loadLibrary(resolved, argument); |
| + scanner.importLibrary(library, importedLibrary, tag, patch); |
| + if (resolved.scheme == "dart") { |
|
floitsch
2012/07/03 12:06:55
I would prefer this check in 'patchDartLibrary'. T
Lasse Reichstein Nielsen
2012/07/03 12:55:04
This is not a check to avoid patching non-dart lib
|
| + delayedPatches[resolved.path] = importedLibrary; |
| + } |
| + } |
| + } |
| + // Mark library as already patched. |
| library.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); |
| + }); |
| } |
| bool patchSignatureMatches(FunctionElement original, FunctionElement patch) { |