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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 Compiler compiler, Element element, MetadataAnnotation annotation) { | 404 Compiler compiler, Element element, MetadataAnnotation annotation) { |
405 return getPatchVersion(annotation); | 405 return getPatchVersion(annotation); |
406 } | 406 } |
407 | 407 |
408 @override | 408 @override |
409 void validate(Compiler compiler, Element element, | 409 void validate(Compiler compiler, Element element, |
410 MetadataAnnotation annotation, ConstantValue constant) { | 410 MetadataAnnotation annotation, ConstantValue constant) { |
411 ResolutionDartType annotationType = | 411 ResolutionDartType annotationType = |
412 constant.getType(compiler.commonElements); | 412 constant.getType(compiler.commonElements); |
413 if (annotationType.element != | 413 if (annotationType.element != |
414 compiler.backend.helpers.patchAnnotationClass) { | 414 compiler.commonElements.patchAnnotationClass) { |
415 DiagnosticReporter reporter = compiler.reporter; | 415 DiagnosticReporter reporter = compiler.reporter; |
416 reporter.internalError(annotation, 'Invalid patch annotation.'); | 416 reporter.internalError(annotation, 'Invalid patch annotation.'); |
417 } | 417 } |
418 } | 418 } |
419 } | 419 } |
420 | 420 |
421 void tryPatchGetter( | 421 void tryPatchGetter( |
422 DiagnosticReporter reporter, Element origin, FunctionElement patch) { | 422 DiagnosticReporter reporter, Element origin, FunctionElement patch) { |
423 if (!origin.isAbstractField) { | 423 if (!origin.isAbstractField) { |
424 reporter.reportError( | 424 reporter.reportError( |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 527 |
528 class PatchVersion { | 528 class PatchVersion { |
529 final String tag; | 529 final String tag; |
530 | 530 |
531 const PatchVersion(this.tag); | 531 const PatchVersion(this.tag); |
532 | 532 |
533 bool isActive(String patchTag) => tag == null || tag == patchTag; | 533 bool isActive(String patchTag) => tag == null || tag == patchTag; |
534 | 534 |
535 String toString() => 'PatchVersion($tag)'; | 535 String toString() => 'PatchVersion($tag)'; |
536 } | 536 } |
OLD | NEW |