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

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

Issue 10905305: Patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Replaced includeInjectedMembers by implementation Created 8 years, 3 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/js_backend/namer.dart
diff --git a/lib/compiler/implementation/js_backend/namer.dart b/lib/compiler/implementation/js_backend/namer.dart
index 80518d3fa748eda142cbac1c9f7cde1f76fddff5..9c89e19d0a0ab8d103e2a21ea206b7b8b00264b1 100644
--- a/lib/compiler/implementation/js_backend/namer.dart
+++ b/lib/compiler/implementation/js_backend/namer.dart
@@ -18,6 +18,12 @@ class Namer {
return _jsReserved;
}
+ /**
+ * Map from top-level or static elements to their unique identifiers provided
+ * by [getName].
+ *
+ * Invariant: Keys must be declaration elements.
+ */
final Map<Element, String> globals;
final Map<String, int> usedGlobals;
final Map<String, LibraryElement> shortPrivateNameOwners;
@@ -113,7 +119,7 @@ class Namer {
} else {
StringBuffer suffix = new StringBuffer();
signature.forEachOptionalParameter((Element element) {
- String jsName = JsNames.getValid(element.name.slowToString());
+ String jsName = JsNames.getValid(element.name.slowToString());
suffix.add('\$$jsName');
});
return '$methodName$suffix';
@@ -244,6 +250,9 @@ class Namer {
node: element.parseNode(compiler));
}
} else {
+ // Use declaration element to ensure invariant on [globals].
+ element = element.declaration;
+
// Dealing with a top-level or static element.
String cached = globals[element];
if (cached !== null) return cached;

Powered by Google App Engine
This is Rietveld 408576698