Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: lib/compiler/implementation/compiler.dart

Issue 10837140: Make addGetterOrSetter (now: defineAccessor) not add the abstract field as a member. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/compiler.dart
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index ca6ca2ba8cb60374a28e6029a5089e9d50e33292..852f7fd90956be13dc9bca5e1c525103ee873710 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -556,42 +556,19 @@ class Compiler implements DiagnosticListener {
while (!patches.isEmpty()) {
Element patchElement = patches.head;
Element originalElement = lookup(patchElement.name);
- if (patchElement.isAccessor()) {
- // Skip accessors. An accessor always has an abstract field,
- // representing the accessor in the lookup scope. We can thus skip the
- // accessors and just handle the abstract field.
- } else if (patchElement.kind === ElementKind.ABSTRACT_FIELD) {
- // Getters and setters are kept inside a synthetic field.
- if (originalElement !== null &&
- originalElement.kind !== ElementKind.ABSTRACT_FIELD) {
+ if (patchElement.isAccessor() && originalElement !== null) {
Anders Johnsen 2012/08/07 13:02:30 Maybe move originalElement !== null check out (and
+ if (originalElement.kind !== ElementKind.ABSTRACT_FIELD) {
internalError("Cannot patch non-getter/setter with getter/setter",
element: originalElement);
}
- AbstractFieldElement patchField = patchElement;
AbstractFieldElement originalField = originalElement;
- if (patchField.getter !== null) {
- if (originalField === null || originalField.getter === null) {
- original.addGetterOrSetter(clonePatch(patchField.getter),
- originalField,
- this);
- if (originalField === null && patchField.setter !== null) {
- // It exists now, so find it for the setter patching.
- originalField = lookup(patchElement.name);
- }
- } else {
- patchMember(originalField.getter, patchField.getter);
- }
+ if (patchElement.isGetter()) {
+ originalElement = originalField.getter;
+ } else {
+ originalElement = originalField.setter;
}
- if (patchField.setter !== null) {
- if (originalField === null || originalField.setter === null) {
- original.addGetterOrSetter(clonePatch(patchField.setter),
- originalField,
- this);
- } else {
- patchMember(originalField.setter, patchField.setter);
- }
- }
- } else if (originalElement === null) {
+ }
+ if (originalElement === null) {
if (isPatchElement(patchElement)) {
internalError("Cannot patch non-existing member '"
"${patchElement.name.slowToString()}'.");
« no previous file with comments | « no previous file | lib/compiler/implementation/elements/elements.dart » ('j') | lib/compiler/implementation/elements/elements.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698