| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 import 'parser/parser.dart' show Parser; | 139 import 'parser/parser.dart' show Parser; |
| 140 import 'parser/partial_elements.dart' show PartialClassElement; | 140 import 'parser/partial_elements.dart' show PartialClassElement; |
| 141 import 'parser/partial_parser.dart' show PartialParser; | 141 import 'parser/partial_parser.dart' show PartialParser; |
| 142 import 'scanner/scanner.dart' show Scanner; | 142 import 'scanner/scanner.dart' show Scanner; |
| 143 import 'script.dart'; | 143 import 'script.dart'; |
| 144 import 'tokens/token.dart' show StringToken, Token; | 144 import 'tokens/token.dart' show StringToken, Token; |
| 145 | 145 |
| 146 class PatchParserTask extends CompilerTask { | 146 class PatchParserTask extends CompilerTask { |
| 147 final String name = "Patching Parser"; | 147 final String name = "Patching Parser"; |
| 148 final ParserOptions parserOptions; | 148 final ParserOptions parserOptions; |
| 149 final Compiler compiler; |
| 150 DiagnosticReporter get reporter => compiler.reporter; |
| 149 | 151 |
| 150 PatchParserTask(Compiler compiler, this.parserOptions) : super(compiler); | 152 PatchParserTask(Compiler compiler, this.parserOptions) |
| 153 : compiler = compiler, |
| 154 super(compiler.measurer); |
| 151 | 155 |
| 152 /** | 156 /** |
| 153 * Scans a library patch file, applies the method patches and | 157 * Scans a library patch file, applies the method patches and |
| 154 * injections to the library, and returns a list of class | 158 * injections to the library, and returns a list of class |
| 155 * patches. | 159 * patches. |
| 156 */ | 160 */ |
| 157 Future patchLibrary( | 161 Future patchLibrary( |
| 158 LibraryLoader loader, Uri patchUri, LibraryElement originLibrary) { | 162 LibraryLoader loader, Uri patchUri, LibraryElement originLibrary) { |
| 159 return compiler.readScript(patchUri, originLibrary).then((Script script) { | 163 return compiler.readScript(patchUri, originLibrary).then((Script script) { |
| 160 var patchLibrary = new LibraryElementX(script, null, originLibrary); | 164 var patchLibrary = new LibraryElementX(script, null, originLibrary); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 615 |
| 612 class PatchVersion { | 616 class PatchVersion { |
| 613 final String tag; | 617 final String tag; |
| 614 | 618 |
| 615 const PatchVersion(this.tag); | 619 const PatchVersion(this.tag); |
| 616 | 620 |
| 617 bool isActive(String patchTag) => tag == null || tag == patchTag; | 621 bool isActive(String patchTag) => tag == null || tag == patchTag; |
| 618 | 622 |
| 619 String toString() => 'PatchVersion($tag)'; | 623 String toString() => 'PatchVersion($tag)'; |
| 620 } | 624 } |
| OLD | NEW |