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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 return hasJsInterop ? true : null; | 495 return hasJsInterop ? true : null; |
496 } | 496 } |
497 | 497 |
498 @override | 498 @override |
499 void validate(Compiler compiler, | 499 void validate(Compiler compiler, |
500 Element element, | 500 Element element, |
501 MetadataAnnotation annotation, | 501 MetadataAnnotation annotation, |
502 ConstantValue constant) { | 502 ConstantValue constant) { |
503 JavaScriptBackend backend = compiler.backend; | 503 JavaScriptBackend backend = compiler.backend; |
504 if (constant.getType(compiler.coreTypes).element != | 504 if (constant.getType(compiler.coreTypes).element != |
505 backend.jsAnnotationClass) { | 505 backend.helpers.jsAnnotationClass) { |
506 compiler.reporter.internalError(annotation, 'Invalid @JS(...) annotation.'
); | 506 compiler.reporter.internalError(annotation, 'Invalid @JS(...) annotation.'
); |
507 } | 507 } |
508 } | 508 } |
509 } | 509 } |
510 | 510 |
511 /// Annotation handler for pre-resolution detection of `@patch` annotations. | 511 /// Annotation handler for pre-resolution detection of `@patch` annotations. |
512 class PatchAnnotationHandler implements EagerAnnotationHandler<PatchVersion> { | 512 class PatchAnnotationHandler implements EagerAnnotationHandler<PatchVersion> { |
513 const PatchAnnotationHandler(); | 513 const PatchAnnotationHandler(); |
514 | 514 |
515 PatchVersion getPatchVersion(MetadataAnnotation annotation) { | 515 PatchVersion getPatchVersion(MetadataAnnotation annotation) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 688 |
689 class PatchVersion { | 689 class PatchVersion { |
690 final String tag; | 690 final String tag; |
691 | 691 |
692 const PatchVersion(this.tag); | 692 const PatchVersion(this.tag); |
693 | 693 |
694 bool isActive(String patchTag) => tag == null || tag == patchTag; | 694 bool isActive(String patchTag) => tag == null || tag == patchTag; |
695 | 695 |
696 String toString() => 'PatchVersion($tag)'; | 696 String toString() => 'PatchVersion($tag)'; |
697 } | 697 } |
OLD | NEW |