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

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

Issue 10511008: Support overriding fields with fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 6 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 | « dart/lib/compiler/implementation/emitter.dart ('k') | dart/lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/namer.dart
diff --git a/dart/lib/compiler/implementation/namer.dart b/dart/lib/compiler/implementation/namer.dart
index 50cb24fdf333624c072496da024d9b583b33f45a..1d46c91b09a679cc836701b7019ef9666f7879e9 100644
--- a/dart/lib/compiler/implementation/namer.dart
+++ b/dart/lib/compiler/implementation/namer.dart
@@ -80,21 +80,28 @@ class Namer {
return '${privateName(lib, name)}\$${selector.argumentCount}$buffer';
}
- String instanceFieldName(LibraryElement lib, SourceString name) {
- String proposedName = privateName(lib, name);
+ String instanceFieldName(ClassElement cls, SourceString name) {
+ String proposedName = privateName(cls.getLibrary(), name);
+ if (cls.lookupSuperMember(name) !== null) {
+ String libName = getName(cls.getLibrary());
+ String clsName = getName(cls);
+ proposedName = '$libName\$$clsName\$$proposedName';
+ }
return safeName(proposedName);
}
String setterName(LibraryElement lib, SourceString name) {
// We dynamically create setters from the field-name. The setter name must
// therefore be derived from the instance field-name.
- return 'set\$${instanceFieldName(lib, name)}';
+ String safeName = safeName(privateName(lib, name));
+ return 'set\$$safeName';
}
String getterName(LibraryElement lib, SourceString name) {
// We dynamically create getters from the field-name. The getter name must
// therefore be derived from the instance field-name.
- return 'get\$${instanceFieldName(lib, name)}';
+ String safeName = safeName(privateName(lib, name));
+ return 'get\$$safeName';
}
String getFreshGlobalName(String proposedName) {
@@ -180,7 +187,7 @@ class Namer {
} else if (element.kind == ElementKind.SETTER) {
return setterName(element.getLibrary(), element.name);
} else {
- return instanceFieldName(element.getLibrary(), element.name);
+ return instanceFieldName(element.getEnclosingClass(), element.name);
}
} else {
// Dealing with a top-level or static element.
« no previous file with comments | « dart/lib/compiler/implementation/emitter.dart ('k') | dart/lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698