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. An accessor always have an abstract field, |
|
floitsch
2012/08/01 09:05:01
has
Anders Johnsen
2012/08/01 09:15:38
Done.
| |
| 561 // representing the accessor in the lookup scope. We can then always | |
|
floitsch
2012/08/01 09:05:01
We can thus skip the accessor and just handle the
Anders Johnsen
2012/08/01 09:15:38
Done.
| |
| 562 // skip accessors and just handle the abstract field. | |
| 563 } else if (patchElement.kind === ElementKind.ABSTRACT_FIELD) { | |
| 564 // Getters and setters are kept inside a synthetic field. | |
| 561 if (originalElement !== null && | 565 if (originalElement !== null && |
| 562 originalElement.kind !== ElementKind.ABSTRACT_FIELD) { | 566 originalElement.kind !== ElementKind.ABSTRACT_FIELD) { |
| 563 internalError("Cannot patch non-getter/setter with getter/setter", | 567 internalError("Cannot patch non-getter/setter with getter/setter", |
| 564 element: originalElement); | 568 element: originalElement); |
| 565 } | 569 } |
| 566 AbstractFieldElement patchField = patchElement; | 570 AbstractFieldElement patchField = patchElement; |
| 567 AbstractFieldElement originalField = originalElement; | 571 AbstractFieldElement originalField = originalElement; |
| 568 if (patchField.getter !== null) { | 572 if (patchField.getter !== null) { |
| 569 if (originalField === null || originalField.getter === null) { | 573 if (originalField === null || originalField.getter === null) { |
| 570 original.addGetterOrSetter(clonePatch(patchField.getter), | 574 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; | 1095 final endOffset = end.charOffset + end.slowCharCount; |
| 1092 | 1096 |
| 1093 // [begin] and [end] might be the same for the same empty token. This | 1097 // [begin] and [end] might be the same for the same empty token. This |
| 1094 // happens for instance when scanning '$$'. | 1098 // happens for instance when scanning '$$'. |
| 1095 assert(endOffset >= beginOffset); | 1099 assert(endOffset >= beginOffset); |
| 1096 return f(beginOffset, endOffset); | 1100 return f(beginOffset, endOffset); |
| 1097 } | 1101 } |
| 1098 | 1102 |
| 1099 String toString() => 'SourceSpan($uri, $begin, $end)'; | 1103 String toString() => 'SourceSpan($uri, $begin, $end)'; |
| 1100 } | 1104 } |
| OLD | NEW |