| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 402 } |
| 403 return null; | 403 return null; |
| 404 } | 404 } |
| 405 | 405 |
| 406 String apply( | 406 String apply( |
| 407 Compiler compiler, Element element, MetadataAnnotation annotation) { | 407 Compiler compiler, Element element, MetadataAnnotation annotation) { |
| 408 if (element.isClass) { | 408 if (element.isClass) { |
| 409 String native = getNativeAnnotation(annotation); | 409 String native = getNativeAnnotation(annotation); |
| 410 if (native != null) { | 410 if (native != null) { |
| 411 JavaScriptBackend backend = compiler.backend; | 411 JavaScriptBackend backend = compiler.backend; |
| 412 backend.nativeDataBuilder.setNativeClassTagInfo(element, native); | 412 backend.nativeClassDataBuilder.setNativeClassTagInfo(element, native); |
| 413 return native; | 413 return native; |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 return null; | 416 return null; |
| 417 } | 417 } |
| 418 | 418 |
| 419 void validate(Compiler compiler, Element element, | 419 void validate(Compiler compiler, Element element, |
| 420 MetadataAnnotation annotation, ConstantValue constant) { | 420 MetadataAnnotation annotation, ConstantValue constant) { |
| 421 ResolutionDartType annotationType = | 421 ResolutionDartType annotationType = |
| 422 constant.getType(compiler.commonElements); | 422 constant.getType(compiler.commonElements); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 434 const JsInteropAnnotationHandler(); | 434 const JsInteropAnnotationHandler(); |
| 435 | 435 |
| 436 bool hasJsNameAnnotation(MetadataAnnotationX annotation) => | 436 bool hasJsNameAnnotation(MetadataAnnotationX annotation) => |
| 437 annotation.beginToken != null && annotation.beginToken.next.value == 'JS'; | 437 annotation.beginToken != null && annotation.beginToken.next.value == 'JS'; |
| 438 | 438 |
| 439 bool apply( | 439 bool apply( |
| 440 Compiler compiler, Element element, MetadataAnnotation annotation) { | 440 Compiler compiler, Element element, MetadataAnnotation annotation) { |
| 441 bool hasJsInterop = hasJsNameAnnotation(annotation); | 441 bool hasJsInterop = hasJsNameAnnotation(annotation); |
| 442 if (hasJsInterop) { | 442 if (hasJsInterop) { |
| 443 JavaScriptBackend backend = compiler.backend; | 443 JavaScriptBackend backend = compiler.backend; |
| 444 backend.nativeDataBuilder.markAsJsInterop(element); | 444 backend.nativeClassDataBuilder.markAsJsInterop(element); |
| 445 } | 445 } |
| 446 // Due to semantics of apply in the baseclass we have to return null to | 446 // Due to semantics of apply in the baseclass we have to return null to |
| 447 // indicate that no match was found. | 447 // indicate that no match was found. |
| 448 return hasJsInterop ? true : null; | 448 return hasJsInterop ? true : null; |
| 449 } | 449 } |
| 450 | 450 |
| 451 @override | 451 @override |
| 452 void validate(Compiler compiler, Element element, | 452 void validate(Compiler compiler, Element element, |
| 453 MetadataAnnotation annotation, ConstantValue constant) { | 453 MetadataAnnotation annotation, ConstantValue constant) { |
| 454 JavaScriptBackend backend = compiler.backend; | 454 JavaScriptBackend backend = compiler.backend; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 607 |
| 608 class PatchVersion { | 608 class PatchVersion { |
| 609 final String tag; | 609 final String tag; |
| 610 | 610 |
| 611 const PatchVersion(this.tag); | 611 const PatchVersion(this.tag); |
| 612 | 612 |
| 613 bool isActive(String patchTag) => tag == null || tag == patchTag; | 613 bool isActive(String patchTag) => tag == null || tag == patchTag; |
| 614 | 614 |
| 615 String toString() => 'PatchVersion($tag)'; | 615 String toString() => 'PatchVersion($tag)'; |
| 616 } | 616 } |
| OLD | NEW |