| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 import 'parser/partial_parser.dart' show | 147 import 'parser/partial_parser.dart' show |
| 148 PartialParser; | 148 PartialParser; |
| 149 import 'parser/parser.dart' show | 149 import 'parser/parser.dart' show |
| 150 Parser; | 150 Parser; |
| 151 import 'scanner/scanner.dart' show | 151 import 'scanner/scanner.dart' show |
| 152 Scanner; | 152 Scanner; |
| 153 import 'script.dart'; | 153 import 'script.dart'; |
| 154 import 'tokens/token.dart' show | 154 import 'tokens/token.dart' show |
| 155 StringToken, | 155 StringToken, |
| 156 Token; | 156 Token; |
| 157 import 'util/util.dart'; | |
| 158 | 157 |
| 159 class PatchParserTask extends CompilerTask { | 158 class PatchParserTask extends CompilerTask { |
| 160 final String name = "Patching Parser"; | 159 final String name = "Patching Parser"; |
| 161 | 160 |
| 162 PatchParserTask(Compiler compiler): super(compiler); | 161 PatchParserTask(Compiler compiler): super(compiler); |
| 163 | 162 |
| 164 /** | 163 /** |
| 165 * Scans a library patch file, applies the method patches and | 164 * Scans a library patch file, applies the method patches and |
| 166 * injections to the library, and returns a list of class | 165 * injections to the library, and returns a list of class |
| 167 * patches. | 166 * patches. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 /// annotation marker matching metadata was found. | 391 /// annotation marker matching metadata was found. |
| 393 static checkAnnotation(Compiler compiler, | 392 static checkAnnotation(Compiler compiler, |
| 394 Element element, | 393 Element element, |
| 395 EagerAnnotationHandler handler) { | 394 EagerAnnotationHandler handler) { |
| 396 for (MetadataAnnotation annotation in element.implementation.metadata) { | 395 for (MetadataAnnotation annotation in element.implementation.metadata) { |
| 397 var result = handler.apply(compiler, element, annotation); | 396 var result = handler.apply(compiler, element, annotation); |
| 398 if (result != null) { | 397 if (result != null) { |
| 399 // TODO(johnniwinther): Perform this check in | 398 // TODO(johnniwinther): Perform this check in |
| 400 // [Compiler.onLibrariesLoaded]. | 399 // [Compiler.onLibrariesLoaded]. |
| 401 compiler.enqueuer.resolution.addDeferredAction(element, () { | 400 compiler.enqueuer.resolution.addDeferredAction(element, () { |
| 402 annotation.ensureResolved(compiler); | 401 annotation.ensureResolved(compiler.resolution); |
| 403 handler.validate( | 402 handler.validate( |
| 404 compiler, element, annotation, | 403 compiler, element, annotation, |
| 405 compiler.constants.getConstantValue(annotation.constant)); | 404 compiler.constants.getConstantValue(annotation.constant)); |
| 406 }); | 405 }); |
| 407 return result; | 406 return result; |
| 408 } | 407 } |
| 409 } | 408 } |
| 410 return null; | 409 return null; |
| 411 } | 410 } |
| 412 } | 411 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 631 |
| 633 class PatchVersion { | 632 class PatchVersion { |
| 634 final String tag; | 633 final String tag; |
| 635 | 634 |
| 636 const PatchVersion(this.tag); | 635 const PatchVersion(this.tag); |
| 637 | 636 |
| 638 bool isActive(String patchTag) => tag == null || tag == patchTag; | 637 bool isActive(String patchTag) => tag == null || tag == patchTag; |
| 639 | 638 |
| 640 String toString() => 'PatchVersion($tag)'; | 639 String toString() => 'PatchVersion($tag)'; |
| 641 } | 640 } |
| OLD | NEW |