Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1076)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/patch_parser.dart

Issue 25559004: Handle exports being registered before declarations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated status + comment. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * This library contains the infrastructure to parse and integrate patch files. 6 * This library contains the infrastructure to parse and integrate patch files.
7 * 7 *
8 * Three types of elements can be patched: [LibraryElement], [ClassElement], 8 * Three types of elements can be patched: [LibraryElement], [ClassElement],
9 * [FunctionElement]. Patches are introduced in patch libraries which are loaded 9 * [FunctionElement]. Patches are introduced in patch libraries which are loaded
10 * together with the corresponding origin library. Which libraries that are 10 * together with the corresponding origin library. Which libraries that are
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 var patchLibrary = new LibraryElementX(script, null, originLibrary); 138 var patchLibrary = new LibraryElementX(script, null, originLibrary);
139 return compiler.withCurrentElement(patchLibrary, () { 139 return compiler.withCurrentElement(patchLibrary, () {
140 handler.registerNewLibrary(patchLibrary); 140 handler.registerNewLibrary(patchLibrary);
141 var imports = new LinkBuilder<tree.LibraryTag>(); 141 var imports = new LinkBuilder<tree.LibraryTag>();
142 compiler.withCurrentElement(patchLibrary.entryCompilationUnit, () { 142 compiler.withCurrentElement(patchLibrary.entryCompilationUnit, () {
143 // This patches the elements of the patch library into [library]. 143 // This patches the elements of the patch library into [library].
144 // Injected elements are added directly under the compilation unit. 144 // Injected elements are added directly under the compilation unit.
145 // Patch elements are stored on the patched functions or classes. 145 // Patch elements are stored on the patched functions or classes.
146 scanLibraryElements(patchLibrary.entryCompilationUnit, imports); 146 scanLibraryElements(patchLibrary.entryCompilationUnit, imports);
147 }); 147 });
148 // After scanning declarations, we handle the import tags in the patch.
149 // TODO(lrn): These imports end up in the original library and are in
150 // scope for the original methods too. This should be fixed.
151 compiler.importHelperLibrary(originLibrary);
152 // TODO(rnystrom): Remove .toList() here if #11523 is fixed. 148 // TODO(rnystrom): Remove .toList() here if #11523 is fixed.
153 return Future.forEach(imports.toLink().toList(), (tag) { 149 return Future.forEach(imports.toLink().toList(), (tag) {
154 return compiler.withCurrentElement(patchLibrary, () { 150 return compiler.withCurrentElement(patchLibrary, () {
155 return compiler.libraryLoader.registerLibraryFromTag( 151 return compiler.libraryLoader.registerLibraryFromTag(
156 handler, patchLibrary, tag); 152 handler, patchLibrary, tag);
157 }); 153 });
158 }); 154 });
159 }); 155 });
160 }); 156 });
161 } 157 }
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 549
554 // TODO(johnniwinther): Add unittest when patch is (real) metadata. 550 // TODO(johnniwinther): Add unittest when patch is (real) metadata.
555 bool isPatchElement(Element element) { 551 bool isPatchElement(Element element) {
556 // TODO(lrn): More checks needed if we introduce metadata for real. 552 // TODO(lrn): More checks needed if we introduce metadata for real.
557 // In that case, it must have the identifier "native" as metadata. 553 // In that case, it must have the identifier "native" as metadata.
558 for (Link link = element.metadata; !link.isEmpty; link = link.tail) { 554 for (Link link = element.metadata; !link.isEmpty; link = link.tail) {
559 if (link.head is PatchMetadataAnnotation) return true; 555 if (link.head is PatchMetadataAnnotation) return true;
560 } 556 }
561 return false; 557 return false;
562 } 558 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/library_loader.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698