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

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

Issue 10832109: Refactor the way we emit no such method handlers so it's easier to optimize it later. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve NSM handling. Created 8 years, 5 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..0560a0aac2316d8affbd4907402658416758e40e 100644
--- a/lib/compiler/implementation/namer.dart
+++ b/lib/compiler/implementation/namer.dart
@@ -20,11 +20,13 @@ class Namer {
Map<Element, String> globals;
Map<String, int> usedGlobals;
+ Map<String, Set<LibraryElement>> usedPrivateNames;
Map<String, LibraryElement> shortPrivateNameOwners;
Namer(this.compiler)
: globals = new Map<Element, String>(),
usedGlobals = new Map<String, int>(),
+ usedPrivateNames = new Map<String, Set<LibraryElement>>(),
shortPrivateNameOwners = new Map<String, LibraryElement>();
final String CURRENT_ISOLATE = @'$';
@@ -78,6 +80,13 @@ class Namer {
if (name.isPrivate()) {
String nameString = name.slowToString();
+ // TODO(kasperl): This is a bit of a hacky way of keeping track
+ // of the libraries that use a particular private name.
+ Set<LibraryElement> usedBy =
+ usedPrivateNames.putIfAbsent(nameString, () =>
+ new Set<LibraryElement>());
+ usedBy.add(lib);
+
// The first library asking for a short private name wins.
LibraryElement owner =
shortPrivateNameOwners.putIfAbsent(nameString, () => lib);

Powered by Google App Engine
This is Rietveld 408576698