| OLD | NEW |
| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 LinkBuilder<tree.LibraryTag> imports = new LinkBuilder<tree.LibraryTag>(); | 136 LinkBuilder<tree.LibraryTag> imports = new LinkBuilder<tree.LibraryTag>(); |
| 137 compiler.withCurrentElement(patchLibrary.entryCompilationUnit, () { | 137 compiler.withCurrentElement(patchLibrary.entryCompilationUnit, () { |
| 138 // This patches the elements of the patch library into [library]. | 138 // This patches the elements of the patch library into [library]. |
| 139 // Injected elements are added directly under the compilation unit. | 139 // Injected elements are added directly under the compilation unit. |
| 140 // Patch elements are stored on the patched functions or classes. | 140 // Patch elements are stored on the patched functions or classes. |
| 141 scanLibraryElements(patchLibrary.entryCompilationUnit, imports); | 141 scanLibraryElements(patchLibrary.entryCompilationUnit, imports); |
| 142 }); | 142 }); |
| 143 // After scanning declarations, we handle the import tags in the patch. | 143 // After scanning declarations, we handle the import tags in the patch. |
| 144 // TODO(lrn): These imports end up in the original library and are in | 144 // TODO(lrn): These imports end up in the original library and are in |
| 145 // scope for the original methods too. This should be fixed. | 145 // scope for the original methods too. This should be fixed. |
| 146 compiler.importHelperLibrary(originLibrary); |
| 146 for (tree.LibraryTag tag in imports.toLink()) { | 147 for (tree.LibraryTag tag in imports.toLink()) { |
| 147 compiler.scanner.importLibraryFromTag(tag, | 148 compiler.scanner.importLibraryFromTag(tag, |
| 148 patchLibrary.entryCompilationUnit); | 149 patchLibrary.entryCompilationUnit); |
| 149 } | 150 } |
| 150 } | 151 } |
| 151 | 152 |
| 152 void scanLibraryElements( | 153 void scanLibraryElements( |
| 153 CompilationUnitElement compilationUnit, | 154 CompilationUnitElement compilationUnit, |
| 154 LinkBuilder<tree.LibraryTag> imports) { | 155 LinkBuilder<tree.LibraryTag> imports) { |
| 155 measure(() { | 156 measure(() { |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 super.addMember(element); | 490 super.addMember(element); |
| 490 } | 491 } |
| 491 } | 492 } |
| 492 | 493 |
| 493 // TODO(ahe): Get rid of this class. | 494 // TODO(ahe): Get rid of this class. |
| 494 class PatchMetadataAnnotation extends MetadataAnnotation { | 495 class PatchMetadataAnnotation extends MetadataAnnotation { |
| 495 final leg.Constant value = null; | 496 final leg.Constant value = null; |
| 496 | 497 |
| 497 PatchMetadataAnnotation() : super(STATE_DONE); | 498 PatchMetadataAnnotation() : super(STATE_DONE); |
| 498 } | 499 } |
| OLD | NEW |