Chromium Code Reviews| 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 } | 455 } |
| 456 // Due to semantics of apply in the baseclass we have to return null to | 456 // Due to semantics of apply in the baseclass we have to return null to |
| 457 // indicate that no match was found. | 457 // indicate that no match was found. |
| 458 return hasJsInterop ? true : null; | 458 return hasJsInterop ? true : null; |
| 459 } | 459 } |
| 460 | 460 |
| 461 @override | 461 @override |
| 462 void validate(Compiler compiler, Element element, | 462 void validate(Compiler compiler, Element element, |
| 463 MetadataAnnotation annotation, ConstantValue constant) { | 463 MetadataAnnotation annotation, ConstantValue constant) { |
| 464 JavaScriptBackend backend = compiler.backend; | 464 JavaScriptBackend backend = compiler.backend; |
| 465 if (constant.getType(compiler.commonElements).element != | 465 ResolutionDartType type = constant.getType(compiler.commonElements); |
| 466 backend.helpers.jsAnnotationClass) { | 466 if (type.element != backend.helpers.jsAnnotationClass) { |
| 467 compiler.reporter | 467 compiler.reporter |
| 468 .internalError(annotation, 'Invalid @JS(...) annotation.'); | 468 .internalError(annotation, 'Invalid @JS(...) annotation.'); |
|
Siggi Cherem (dart-lang)
2017/01/11 22:57:47
sigh - no action for this CL, but we really need t
Johnni Winther
2017/01/12 11:17:45
Acknowledged.
| |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 | 472 |
| 473 /// Annotation handler for pre-resolution detection of `@patch` annotations. | 473 /// Annotation handler for pre-resolution detection of `@patch` annotations. |
| 474 class PatchAnnotationHandler implements EagerAnnotationHandler<PatchVersion> { | 474 class PatchAnnotationHandler implements EagerAnnotationHandler<PatchVersion> { |
| 475 const PatchAnnotationHandler(); | 475 const PatchAnnotationHandler(); |
| 476 | 476 |
| 477 PatchVersion getPatchVersion(MetadataAnnotationX annotation) { | 477 PatchVersion getPatchVersion(MetadataAnnotationX annotation) { |
| 478 if (annotation.beginToken != null) { | 478 if (annotation.beginToken != null) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 | 617 |
| 618 class PatchVersion { | 618 class PatchVersion { |
| 619 final String tag; | 619 final String tag; |
| 620 | 620 |
| 621 const PatchVersion(this.tag); | 621 const PatchVersion(this.tag); |
| 622 | 622 |
| 623 bool isActive(String patchTag) => tag == null || tag == patchTag; | 623 bool isActive(String patchTag) => tag == null || tag == patchTag; |
| 624 | 624 |
| 625 String toString() => 'PatchVersion($tag)'; | 625 String toString() => 'PatchVersion($tag)'; |
| 626 } | 626 } |
| OLD | NEW |