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 /** | 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 delayedPatches.forEach((String path, LibraryElement importedLibrary) { | 549 delayedPatches.forEach((String path, LibraryElement importedLibrary) { |
| 550 patchDartLibrary(importedLibrary, path); | 550 patchDartLibrary(importedLibrary, path); |
| 551 }); | 551 }); |
| 552 } | 552 } |
| 553 | 553 |
| 554 void applyContainerPatch(ContainerElement original, Link<Element> patches, | 554 void applyContainerPatch(ContainerElement original, Link<Element> patches, |
| 555 Element lookup(SourceString name)) { | 555 Element lookup(SourceString name)) { |
| 556 while (!patches.isEmpty()) { | 556 while (!patches.isEmpty()) { |
| 557 Element patchElement = patches.head; | 557 Element patchElement = patches.head; |
| 558 Element originalElement = lookup(patchElement.name); | 558 Element originalElement = lookup(patchElement.name); |
| 559 // Getters and setters are kept inside a synthetic field. | 559 if (patchElement.isAccessor()) { |
| 560 if (patchElement.kind === ElementKind.ABSTRACT_FIELD) { | 560 // Skip accessors, since we handle them in the abstract field case. |
|
Mads Ager (google)
2012/08/01 08:08:31
Does this mean that there is both an accessor and
Anders Johnsen
2012/08/01 08:35:50
Yep. It's a invariant on the AST. I've updated the
| |
| 561 } else if (patchElement.kind === ElementKind.ABSTRACT_FIELD) { | |
| 562 // Getters and setters are kept inside a synthetic field. | |
| 561 if (originalElement !== null && | 563 if (originalElement !== null && |
| 562 originalElement.kind !== ElementKind.ABSTRACT_FIELD) { | 564 originalElement.kind !== ElementKind.ABSTRACT_FIELD) { |
| 563 internalError("Cannot patch non-getter/setter with getter/setter", | 565 internalError("Cannot patch non-getter/setter with getter/setter", |
| 564 element: originalElement); | 566 element: originalElement); |
| 565 } | 567 } |
| 566 AbstractFieldElement patchField = patchElement; | 568 AbstractFieldElement patchField = patchElement; |
| 567 AbstractFieldElement originalField = originalElement; | 569 AbstractFieldElement originalField = originalElement; |
| 568 if (patchField.getter !== null) { | 570 if (patchField.getter !== null) { |
| 569 if (originalField === null || originalField.getter === null) { | 571 if (originalField === null || originalField.getter === null) { |
| 570 original.addGetterOrSetter(clonePatch(patchField.getter), | 572 original.addGetterOrSetter(clonePatch(patchField.getter), |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1091 final endOffset = end.charOffset + end.slowCharCount; | 1093 final endOffset = end.charOffset + end.slowCharCount; |
| 1092 | 1094 |
| 1093 // [begin] and [end] might be the same for the same empty token. This | 1095 // [begin] and [end] might be the same for the same empty token. This |
| 1094 // happens for instance when scanning '$$'. | 1096 // happens for instance when scanning '$$'. |
| 1095 assert(endOffset >= beginOffset); | 1097 assert(endOffset >= beginOffset); |
| 1096 return f(beginOffset, endOffset); | 1098 return f(beginOffset, endOffset); |
| 1097 } | 1099 } |
| 1098 | 1100 |
| 1099 String toString() => 'SourceSpan($uri, $begin, $end)'; | 1101 String toString() => 'SourceSpan($uri, $begin, $end)'; |
| 1100 } | 1102 } |
| OLD | NEW |