| 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 /** | 6 /** |
| 7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not |
| 8 * compiled. | 8 * compiled. |
| 9 */ | 9 */ |
| 10 final bool REPORT_EXCESS_RESOLUTION = false; | 10 final bool REPORT_EXCESS_RESOLUTION = false; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } else { | 433 } else { |
| 434 patchMember(originalElement, patchElement); | 434 patchMember(originalElement, patchElement); |
| 435 } | 435 } |
| 436 patches = patches.tail; | 436 patches = patches.tail; |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 bool isPatchElement(Element element) { | 440 bool isPatchElement(Element element) { |
| 441 // TODO(lrn): More checks needed if we introduce metadata for real. | 441 // TODO(lrn): More checks needed if we introduce metadata for real. |
| 442 // In that case, it must have the identifier "native" as metadata. | 442 // In that case, it must have the identifier "native" as metadata. |
| 443 return !element.metadata.isEmpty(); | 443 for (Link link = element.metadata; !link.isEmpty(); link = link.tail) { |
| 444 if (link.head is PatchMetadataAnnotation) return true; |
| 445 } |
| 446 return false; |
| 444 } | 447 } |
| 445 | 448 |
| 446 Element clonePatch(Element patchElement, Element enclosing) { | 449 Element clonePatch(Element patchElement, Element enclosing) { |
| 447 // The original library does not have an element with the same name | 450 // The original library does not have an element with the same name |
| 448 // as the patch library element. | 451 // as the patch library element. |
| 449 // In this case, the patch library element must not be marked as "patch", | 452 // In this case, the patch library element must not be marked as "patch", |
| 450 // and its name must make it private. | 453 // and its name must make it private. |
| 451 if (!patchElement.name.isPrivate()) { | 454 if (!patchElement.name.isPrivate()) { |
| 452 internalError("Cannot add non-private member '" | 455 internalError("Cannot add non-private member '" |
| 453 "${patchElement.name.slowToString()}' from patch."); | 456 "${patchElement.name.slowToString()}' from patch."); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 final endOffset = end.charOffset + end.slowCharCount; | 902 final endOffset = end.charOffset + end.slowCharCount; |
| 900 | 903 |
| 901 // [begin] and [end] might be the same for the same empty token. This | 904 // [begin] and [end] might be the same for the same empty token. This |
| 902 // happens for instance when scanning '$$'. | 905 // happens for instance when scanning '$$'. |
| 903 assert(endOffset >= beginOffset); | 906 assert(endOffset >= beginOffset); |
| 904 return f(beginOffset, endOffset); | 907 return f(beginOffset, endOffset); |
| 905 } | 908 } |
| 906 | 909 |
| 907 String toString() => 'SourceSpan($uri, $begin, $end)'; | 910 String toString() => 'SourceSpan($uri, $begin, $end)'; |
| 908 } | 911 } |
| OLD | NEW |