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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 const PatchAnnotationHandler(); | 433 const PatchAnnotationHandler(); |
434 | 434 |
435 PatchVersion getPatchVersion(MetadataAnnotation annotation) { | 435 PatchVersion getPatchVersion(MetadataAnnotation annotation) { |
436 if (annotation.beginToken != null) { | 436 if (annotation.beginToken != null) { |
437 if (annotation.beginToken.next.value == 'patch') { | 437 if (annotation.beginToken.next.value == 'patch') { |
438 return const PatchVersion(null); | 438 return const PatchVersion(null); |
439 } else if (annotation.beginToken.next.value == 'patch_full') { | 439 } else if (annotation.beginToken.next.value == 'patch_full') { |
440 return const PatchVersion('full'); | 440 return const PatchVersion('full'); |
441 } else if (annotation.beginToken.next.value == 'patch_lazy') { | 441 } else if (annotation.beginToken.next.value == 'patch_lazy') { |
442 return const PatchVersion('lazy'); | 442 return const PatchVersion('lazy'); |
| 443 } else if (annotation.beginToken.next.value == 'patch_startup') { |
| 444 return const PatchVersion('startup'); |
443 } | 445 } |
444 } | 446 } |
445 return null; | 447 return null; |
446 } | 448 } |
447 | 449 |
448 @override | 450 @override |
449 PatchVersion apply(Compiler compiler, | 451 PatchVersion apply(Compiler compiler, |
450 Element element, | 452 Element element, |
451 MetadataAnnotation annotation) { | 453 MetadataAnnotation annotation) { |
452 return getPatchVersion(annotation); | 454 return getPatchVersion(annotation); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 570 |
569 class PatchVersion { | 571 class PatchVersion { |
570 final String tag; | 572 final String tag; |
571 | 573 |
572 const PatchVersion(this.tag); | 574 const PatchVersion(this.tag); |
573 | 575 |
574 bool isActive(String patchTag) => tag == null || tag == patchTag; | 576 bool isActive(String patchTag) => tag == null || tag == patchTag; |
575 | 577 |
576 String toString() => 'PatchVersion($tag)'; | 578 String toString() => 'PatchVersion($tag)'; |
577 } | 579 } |
OLD | NEW |