| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * Scans a library patch file, applies the method patches and | 130 * Scans a library patch file, applies the method patches and |
| 131 * injections to the library, and returns a list of class | 131 * injections to the library, and returns a list of class |
| 132 * patches. | 132 * patches. |
| 133 */ | 133 */ |
| 134 void patchLibrary(Uri patchUri, LibraryElement library) { | 134 void patchLibrary(Uri patchUri, LibraryElement library) { |
| 135 leg.Script script = compiler.readScript(patchUri, null); | 135 leg.Script script = compiler.readScript(patchUri, null); |
| 136 CompilationUnitElement compilationUnit = | 136 CompilationUnitElement compilationUnit = |
| 137 new CompilationUnitElement(script, library); | 137 new CompilationUnitElement(script, library); |
| 138 library.addCompilationUnit(compilationUnit); | |
| 139 LinkBuilder<tree.LibraryTag> imports = new LinkBuilder<tree.LibraryTag>(); | 138 LinkBuilder<tree.LibraryTag> imports = new LinkBuilder<tree.LibraryTag>(); |
| 140 compiler.withCurrentElement(compilationUnit, () { | 139 compiler.withCurrentElement(compilationUnit, () { |
| 141 // This patches the elements of the patch library into [library]. | 140 // This patches the elements of the patch library into [library]. |
| 142 // Injected elements are added directly under the compilation unit. | 141 // Injected elements are added directly under the compilation unit. |
| 143 // Patch elements are stored on the patched functions or classes. | 142 // Patch elements are stored on the patched functions or classes. |
| 144 scanLibraryElements(compilationUnit, imports); | 143 scanLibraryElements(compilationUnit, imports); |
| 145 }); | 144 }); |
| 146 // After scanning declarations, we handle the import tags in the patch. | 145 // After scanning declarations, we handle the import tags in the patch. |
| 147 // 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 |
| 148 // scope for the original methods too. This should be fixed. | 147 // scope for the original methods too. This should be fixed. |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 super.addMember(element); | 401 super.addMember(element); |
| 403 } | 402 } |
| 404 } | 403 } |
| 405 | 404 |
| 406 // TODO(ahe): Get rid of this class. | 405 // TODO(ahe): Get rid of this class. |
| 407 class PatchMetadataAnnotation extends MetadataAnnotation { | 406 class PatchMetadataAnnotation extends MetadataAnnotation { |
| 408 final leg.Constant value = null; | 407 final leg.Constant value = null; |
| 409 | 408 |
| 410 PatchMetadataAnnotation() : super(STATE_DONE); | 409 PatchMetadataAnnotation() : super(STATE_DONE); |
| 411 } | 410 } |
| OLD | NEW |