| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return loader.processLibraryTags(patchLibrary); | 170 return loader.processLibraryTags(patchLibrary); |
| 171 }); | 171 }); |
| 172 }); | 172 }); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void scanLibraryElements(CompilationUnitElement compilationUnit) { | 175 void scanLibraryElements(CompilationUnitElement compilationUnit) { |
| 176 measure(() { | 176 measure(() { |
| 177 // TODO(johnniwinther): Test that parts and exports are handled correctly. | 177 // TODO(johnniwinther): Test that parts and exports are handled correctly. |
| 178 Script script = compilationUnit.script; | 178 Script script = compilationUnit.script; |
| 179 Token tokens = new Scanner(script.file).tokenize(); | 179 Token tokens = new Scanner(script.file).tokenize(); |
| 180 Listener patchListener = | 180 Listener patchListener = new PatchElementListener( |
| 181 new PatchElementListener(compiler, compilationUnit, compiler); | 181 compiler, compilationUnit, compiler.idGenerator); |
| 182 try { | 182 try { |
| 183 new PartialParser(patchListener, parserOptions).parseUnit(tokens); | 183 new PartialParser(patchListener, parserOptions).parseUnit(tokens); |
| 184 } on ParserError catch (e) { | 184 } on ParserError catch (e) { |
| 185 // No need to recover from a parser error in platform libraries, user | 185 // No need to recover from a parser error in platform libraries, user |
| 186 // will never see this if the libraries are tested correctly. | 186 // will never see this if the libraries are tested correctly. |
| 187 reporter.internalError( | 187 reporter.internalError( |
| 188 compilationUnit, "Parser error in patch file: $e"); | 188 compilationUnit, "Parser error in patch file: $e"); |
| 189 } | 189 } |
| 190 }); | 190 }); |
| 191 } | 191 } |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 612 |
| 613 class PatchVersion { | 613 class PatchVersion { |
| 614 final String tag; | 614 final String tag; |
| 615 | 615 |
| 616 const PatchVersion(this.tag); | 616 const PatchVersion(this.tag); |
| 617 | 617 |
| 618 bool isActive(String patchTag) => tag == null || tag == patchTag; | 618 bool isActive(String patchTag) => tag == null || tag == patchTag; |
| 619 | 619 |
| 620 String toString() => 'PatchVersion($tag)'; | 620 String toString() => 'PatchVersion($tag)'; |
| 621 } | 621 } |
| OLD | NEW |