| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 return null; | 456 return null; |
| 457 } | 457 } |
| 458 | 458 |
| 459 String apply(Compiler compiler, | 459 String apply(Compiler compiler, |
| 460 Element element, | 460 Element element, |
| 461 MetadataAnnotation annotation) { | 461 MetadataAnnotation annotation) { |
| 462 if (element.isClass) { | 462 if (element.isClass) { |
| 463 String native = getNativeAnnotation(annotation); | 463 String native = getNativeAnnotation(annotation); |
| 464 if (native != null) { | 464 if (native != null) { |
| 465 JavaScriptBackend backend = compiler.backend; | 465 JavaScriptBackend backend = compiler.backend; |
| 466 backend.setNativeClassTagInfo(element, native); | 466 backend.nativeData.setNativeClassTagInfo(element, native); |
| 467 return native; | 467 return native; |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 return null; | 470 return null; |
| 471 } | 471 } |
| 472 | 472 |
| 473 void validate(Compiler compiler, | 473 void validate(Compiler compiler, |
| 474 Element element, | 474 Element element, |
| 475 MetadataAnnotation annotation, | 475 MetadataAnnotation annotation, |
| 476 ConstantValue constant) { | 476 ConstantValue constant) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 489 | 489 |
| 490 bool hasJsNameAnnotation(MetadataAnnotation annotation) => | 490 bool hasJsNameAnnotation(MetadataAnnotation annotation) => |
| 491 annotation.beginToken != null && annotation.beginToken.next.value == 'JS'; | 491 annotation.beginToken != null && annotation.beginToken.next.value == 'JS'; |
| 492 | 492 |
| 493 bool apply(Compiler compiler, | 493 bool apply(Compiler compiler, |
| 494 Element element, | 494 Element element, |
| 495 MetadataAnnotation annotation) { | 495 MetadataAnnotation annotation) { |
| 496 bool hasJsInterop = hasJsNameAnnotation(annotation); | 496 bool hasJsInterop = hasJsNameAnnotation(annotation); |
| 497 if (hasJsInterop) { | 497 if (hasJsInterop) { |
| 498 JavaScriptBackend backend = compiler.backend; | 498 JavaScriptBackend backend = compiler.backend; |
| 499 backend.markAsJsInterop(element); | 499 backend.nativeData.markAsJsInterop(element); |
| 500 } | 500 } |
| 501 // Due to semantics of apply in the baseclass we have to return null to | 501 // Due to semantics of apply in the baseclass we have to return null to |
| 502 // indicate that no match was found. | 502 // indicate that no match was found. |
| 503 return hasJsInterop ? true : null; | 503 return hasJsInterop ? true : null; |
| 504 } | 504 } |
| 505 | 505 |
| 506 @override | 506 @override |
| 507 void validate(Compiler compiler, | 507 void validate(Compiler compiler, |
| 508 Element element, | 508 Element element, |
| 509 MetadataAnnotation annotation, | 509 MetadataAnnotation annotation, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 696 |
| 697 class PatchVersion { | 697 class PatchVersion { |
| 698 final String tag; | 698 final String tag; |
| 699 | 699 |
| 700 const PatchVersion(this.tag); | 700 const PatchVersion(this.tag); |
| 701 | 701 |
| 702 bool isActive(String patchTag) => tag == null || tag == patchTag; | 702 bool isActive(String patchTag) => tag == null || tag == patchTag; |
| 703 | 703 |
| 704 String toString() => 'PatchVersion($tag)'; | 704 String toString() => 'PatchVersion($tag)'; |
| 705 } | 705 } |
| OLD | NEW |