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

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

Issue 10834387: Stop keeping track of the which library use which private selectors. (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
« no previous file with comments | « no previous file | lib/compiler/implementation/namer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/js_backend/emitter.dart
diff --git a/lib/compiler/implementation/js_backend/emitter.dart b/lib/compiler/implementation/js_backend/emitter.dart
index aa64cd873ab237454ccc4a199d9bfa8f7380d103..5436a331e609eaa5689723851ff1f0c94c636a24 100644
--- a/lib/compiler/implementation/js_backend/emitter.dart
+++ b/lib/compiler/implementation/js_backend/emitter.dart
@@ -921,16 +921,7 @@ $classesCollector.$mangledName = {'':
return buffer;
}
- void addNoSuchMethodHandlers(SourceString name, Set<Selector> selectors) {
- // TODO(kasperl): We should really teach private selectors about
- // which libraries they are used from. That way, we wouldn't
- // have to conservatively generate versions for all libraries
- // the name is used from.
- String nameString = name.slowToString();
- Collection<LibraryElement> libraries = name.isPrivate()
- ? namer.usedPrivateNames[nameString]
- : const [ null ];
-
+ void addNoSuchMethodHandlers(SourceString ignore, Set<Selector> selectors) {
ngeoffray 2012/08/17 11:56:57 Should you remove the parameter then?
kasperl 2012/08/17 12:08:44 The plan is to have it go away once we change the
// Cache the object class and type.
ClassElement objectClass = compiler.objectClass;
Type objectType = objectClass.computeType(compiler);
@@ -940,7 +931,7 @@ $classesCollector.$mangledName = {'':
// class has a member that matches the current name and
// selector (grabbed from the scope).
bool hasMatchingMember(ClassElement holder) {
- Element element = holder.lookupMember(name);
+ Element element = holder.lookupMember(selector.name);
if (element === null) return false;
// TODO(kasperl): Consider folding this logic into the
@@ -1014,28 +1005,29 @@ $classesCollector.$mangledName = {'':
Set<ClassElement> holders = noSuchMethodHoldersFor(receiverType);
if (holders.every(hasMatchingMember)) continue;
- for (LibraryElement lib in libraries) {
- String jsName = null;
- String methodName = null;
- if (selector.isGetter()) {
- jsName = namer.getterName(lib, name);
- methodName = 'get:$nameString';
- } else if (selector.isSetter()) {
- jsName = namer.setterName(lib, name);
- methodName = 'set:$nameString';
- } else if (selector.isCall()) {
- jsName = namer.instanceMethodInvocationName(lib, name, selector);
- methodName = nameString;
- } else {
- // We simply ignore selectors that do not need
- // noSuchMethod handlers.
- continue;
- }
- if (!addedJsNames.contains(jsName)) {
- CodeBuffer jsCode = generateMethod(methodName, selector);
- defineInstanceMember(jsName, jsCode);
- addedJsNames.add(jsName);
- }
+ String jsName = null;
+ String methodName = null;
+ String nameString = selector.name.slowToString();
+ if (selector.isGetter()) {
+ jsName = namer.getterName(selector.library, selector.name);
+ methodName = 'get:$nameString';
+ } else if (selector.isSetter()) {
+ jsName = namer.setterName(selector.library, selector.name);
+ methodName = 'set:$nameString';
+ } else if (selector.isCall()) {
+ jsName = namer.instanceMethodInvocationName(
+ selector.library, selector.name, selector);
+ methodName = nameString;
+ } else {
+ // We simply ignore selectors that do not need
+ // noSuchMethod handlers.
+ continue;
+ }
+
+ if (!addedJsNames.contains(jsName)) {
+ CodeBuffer jsCode = generateMethod(methodName, selector);
+ defineInstanceMember(jsName, jsCode);
+ addedJsNames.add(jsName);
}
}
}
« no previous file with comments | « no previous file | lib/compiler/implementation/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698