| 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 * TODO(johnniwinther): The terminology and invariants described below will not | 6 * TODO(johnniwinther): The terminology and invariants described below will not |
| 7 * hold until CL 10905305 has been committed. | 7 * hold until CL 10905305 has been committed. |
| 8 * | 8 * |
| 9 * This library contains the infrastructure to parse and integrate patch files. | 9 * This library contains the infrastructure to parse and integrate patch files. |
| 10 * | 10 * |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 LinkBuilder<tree.LibraryTag> imports = new LinkBuilder<tree.LibraryTag>(); | 138 LinkBuilder<tree.LibraryTag> imports = new LinkBuilder<tree.LibraryTag>(); |
| 139 compiler.withCurrentElement(compilationUnit, () { | 139 compiler.withCurrentElement(compilationUnit, () { |
| 140 // This patches the elements of the patch library into [library]. | 140 // This patches the elements of the patch library into [library]. |
| 141 // Injected elements are added directly under the compilation unit. | 141 // Injected elements are added directly under the compilation unit. |
| 142 // Patch elements are stored on the patched functions or classes. | 142 // Patch elements are stored on the patched functions or classes. |
| 143 scanLibraryElements(compilationUnit, imports); | 143 scanLibraryElements(compilationUnit, imports); |
| 144 }); | 144 }); |
| 145 // After scanning declarations, we handle the import tags in the patch. | 145 // After scanning declarations, we handle the import tags in the patch. |
| 146 // TODO(lrn): These imports end up in the original library and are in | 146 // TODO(lrn): These imports end up in the original library and are in |
| 147 // scope for the original methods too. This should be fixed. | 147 // scope for the original methods too. This should be fixed. |
| 148 compiler.importHelperLibrary(library); |
| 148 for (tree.LibraryTag tag in imports.toLink()) { | 149 for (tree.LibraryTag tag in imports.toLink()) { |
| 149 compiler.scanner.importLibraryFromTag(tag, compilationUnit); | 150 compiler.scanner.importLibraryFromTag(tag, compilationUnit); |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 | 153 |
| 153 void scanLibraryElements( | 154 void scanLibraryElements( |
| 154 CompilationUnitElement compilationUnit, | 155 CompilationUnitElement compilationUnit, |
| 155 LinkBuilder<tree.LibraryTag> imports) { | 156 LinkBuilder<tree.LibraryTag> imports) { |
| 156 measure(() { | 157 measure(() { |
| 157 // TODO(lrn): Possibly recursively handle #source directives in patch. | 158 // TODO(lrn): Possibly recursively handle #source directives in patch. |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 super.addMember(element); | 402 super.addMember(element); |
| 402 } | 403 } |
| 403 } | 404 } |
| 404 | 405 |
| 405 // TODO(ahe): Get rid of this class. | 406 // TODO(ahe): Get rid of this class. |
| 406 class PatchMetadataAnnotation extends MetadataAnnotation { | 407 class PatchMetadataAnnotation extends MetadataAnnotation { |
| 407 final leg.Constant value = null; | 408 final leg.Constant value = null; |
| 408 | 409 |
| 409 PatchMetadataAnnotation() : super(STATE_DONE); | 410 PatchMetadataAnnotation() : super(STATE_DONE); |
| 410 } | 411 } |
| OLD | NEW |