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

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

Issue 10831154: Make field-get/set work without elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. 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 | « lib/compiler/implementation/emitter.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/namer.dart
diff --git a/lib/compiler/implementation/namer.dart b/lib/compiler/implementation/namer.dart
index 0560a0aac2316d8affbd4907402658416758e40e..c30a2784a7ebcbfc9b73064d258398dfdb5311fc 100644
--- a/lib/compiler/implementation/namer.dart
+++ b/lib/compiler/implementation/namer.dart
@@ -122,16 +122,20 @@ class Namer {
return '${privateName(lib, name)}\$${selector.argumentCount}$buffer';
}
- 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';
- }
+ String instanceFieldName(LibraryElement libraryElement, SourceString name) {
+ String proposedName = privateName(libraryElement, name);
return safeName(proposedName);
}
+ String shadowedFieldName(Element fieldElement) {
+ ClassElement cls = fieldElement.getEnclosingClass();
+ LibraryElement libraryElement = fieldElement.getLibrary();
+ String libName = getName(libraryElement);
+ String clsName = getName(cls);
+ String instanceName = instanceFieldName(libraryElement, fieldElement.name);
+ return safeName('$libName\$$clsName\$$instanceName');
+ }
+
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.
@@ -226,7 +230,8 @@ class Namer {
} else if (element.kind == ElementKind.SETTER) {
return setterName(element.getLibrary(), element.name);
} else {
- return instanceFieldName(element.getEnclosingClass(), element.name);
+ compiler.internalError('getName for bad kind: ${element.kind}',
+ node: element.parseNode(compiler));
}
} else {
// Dealing with a top-level or static element.
« no previous file with comments | « lib/compiler/implementation/emitter.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698