| Index: lib/compiler/implementation/compiler.dart
|
| diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
|
| index 69234fe7f8c32557ec96fb69ee1ee7501d6430ed..823f55983f74436cd8853af39455228f180d53d1 100644
|
| --- a/lib/compiler/implementation/compiler.dart
|
| +++ b/lib/compiler/implementation/compiler.dart
|
| @@ -291,7 +291,7 @@ class Compiler implements DiagnosticListener {
|
| // take advantage of this as core and coreimpl import js_helper
|
| // and see Dynamic this way.
|
| withCurrentElement(dynamicClass, () {
|
| - library.define(dynamicClass, this);
|
| + library.addToScope(dynamicClass, this);
|
| });
|
| }
|
| }
|
| @@ -370,19 +370,20 @@ class Compiler implements DiagnosticListener {
|
| }
|
|
|
| void applyLibraryPatch(LibraryElement original, LibraryElement patch) {
|
| - Link<Element> patches = patch.topLevelElements;
|
| - applyContainerPatch(original, patches, original.findLocal);
|
| + Link<Element> patches = patch.localMembers;
|
| + applyContainerPatch(original, patches);
|
|
|
| // Copy imports from patch to original library.
|
| Map<String, LibraryElement> delayedPatches = <LibraryElement>{};
|
| - Uri patchBase = patch.script.uri;
|
| + 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);
|
| + scanner.importLibrary(original, importedLibrary, tag,
|
| + patch.entryCompilationUnit);
|
| if (resolved.scheme == "dart") {
|
| delayedPatches[resolved.path] = importedLibrary;
|
| }
|
| @@ -399,11 +400,11 @@ class Compiler implements DiagnosticListener {
|
| });
|
| }
|
|
|
| - void applyContainerPatch(ContainerElement original, Link<Element> patches,
|
| - Element lookup(SourceString name)) {
|
| + void applyContainerPatch(ScopeContainerElement original,
|
| + Link<Element> patches) {
|
| while (!patches.isEmpty()) {
|
| Element patchElement = patches.head;
|
| - Element originalElement = lookup(patchElement.name);
|
| + Element originalElement = original.localLookup(patchElement.name);
|
| if (patchElement.isAccessor()) {
|
| // Skip accessors. An accessor always has an abstract field,
|
| // representing the accessor in the lookup scope. We can thus skip the
|
| @@ -424,7 +425,7 @@ class Compiler implements DiagnosticListener {
|
| this);
|
| if (originalField === null && patchField.setter !== null) {
|
| // It exists now, so find it for the setter patching.
|
| - originalField = lookup(patchElement.name);
|
| + originalField = original.localLookup(patchElement.name);
|
| }
|
| } else {
|
| patchMember(originalField.getter, patchField.getter);
|
| @@ -535,13 +536,8 @@ class Compiler implements DiagnosticListener {
|
| ClassNode node = original.parseNode(this);
|
| // Parse patch class with "patch" parser.
|
| ClassNode patchNode = patchParser.parsePatchClassNode(patch);
|
| - Link<Element> patches = patch.members;
|
| - Element lookupMemberOrConstructor(SourceString name) {
|
| - Element result = original.lookupLocalMember(name);
|
| - if (result !== null) return result;
|
| - return original.lookupConstructor(name);
|
| - }
|
| - applyContainerPatch(original, patches, lookupMemberOrConstructor);
|
| + Link<Element> patches = patch.localMembers;
|
| + applyContainerPatch(original, patches);
|
| }
|
|
|
| /**
|
| @@ -552,17 +548,17 @@ class Compiler implements DiagnosticListener {
|
|
|
| /** Define the JS helper functions in the given library. */
|
| void addForeignFunctions(LibraryElement library) {
|
| - library.define(new ForeignElement(
|
| + library.addToScope(new ForeignElement(
|
| const SourceString('JS'), library), this);
|
| - library.define(new ForeignElement(
|
| + library.addToScope(new ForeignElement(
|
| const SourceString('UNINTERCEPTED'), library), this);
|
| - library.define(new ForeignElement(
|
| + library.addToScope(new ForeignElement(
|
| const SourceString('JS_HAS_EQUALS'), library), this);
|
| - library.define(new ForeignElement(
|
| + library.addToScope(new ForeignElement(
|
| const SourceString('JS_CURRENT_ISOLATE'), library), this);
|
| - library.define(new ForeignElement(
|
| + library.addToScope(new ForeignElement(
|
| const SourceString('JS_CALL_IN_ISOLATE'), library), this);
|
| - library.define(new ForeignElement(
|
| + library.addToScope(new ForeignElement(
|
| const SourceString('DART_CLOSURE_TO_JS'), library), this);
|
| }
|
|
|
|
|