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

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: Rebased. Created 8 years, 2 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 dafdacc506b87803fa360ff927247082f71abcbd..a5ec408306d4d29ef453bb18f8a2d632f737bd28 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;
@@ -243,6 +249,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