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

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: cleaner validation of member accessors. 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
« no previous file with comments | « no previous file | lib/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/compiler.dart
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index e17e661538d1e27f260fd11c35ca130b636c82b6..863153b90bc8b363c7222b49fca478915aab74a5 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -388,43 +388,19 @@ class Compiler implements DiagnosticListener {
while (!patches.isEmpty()) {
Element patchElement = patches.head;
Element originalElement = original.localLookup(patchElement.name);
- if (patchElement.isAccessor()) {
- // TODO(lrn): When we change to always add accessors to members, and
- // not add abstract fields, the logic here should be reversed.
- // For now, access getters through the abstract field and skip
- // any accessors.
- } 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) {
+ 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, original),
- originalField,
- this);
- if (originalField === null && patchField.setter !== null) {
- // It exists now, so find it for the setter patching.
- originalField = original.localLookup(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, original),
- 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698