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

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: 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/namer.dart
diff --git a/lib/compiler/implementation/namer.dart b/lib/compiler/implementation/namer.dart
index 526a9d1952f059dfbb36ee1a83d070ea2846f44c..5f2a7c59a03d89e7f6b162356aa2626a42d6cbdc 100644
--- a/lib/compiler/implementation/namer.dart
+++ b/lib/compiler/implementation/namer.dart
@@ -113,16 +113,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.
@@ -217,7 +221,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.

Powered by Google App Engine
This is Rietveld 408576698