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

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

Issue 22301009: Retain fewer names for reflection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 2302aec5576d8b4dd92cbe738a3cf234332b6724..a0ba6b43316c6002207ef433df78fcaa4843125a 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -1289,7 +1289,15 @@ class CodeEmitterTask extends CompilerTask {
}
String getReflectionName(elementOrSelector, String mangledName) {
Johnni Winther 2013/08/07 10:47:34 Add documentation to this method.
ahe 2013/08/07 14:03:17 Done.
- if (!backend.retainName(elementOrSelector.name)) return null;
+ SourceString name = elementOrSelector.name;
+ if (!backend.retainName(name)) {
+ if (name == const SourceString('') && elementOrSelector is Element) {
+ // Make sure to retain names of unnamed constructors.
+ if (!backend.isNeededForReflection(elementOrSelector)) return null;
+ } else {
+ return null;
+ }
+ }
// TODO(ahe): Enable the next line when I can tell the difference between
// an instance method and a global. They may have the same mangled name.
// if (recordedMangledNames.contains(mangledName)) return null;
@@ -1961,6 +1969,7 @@ class CodeEmitterTask extends CompilerTask {
buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler));
if (backend.retainName(classElement.name)) {
buffer.write(',$n$n"+${classElement.name.slowToString()}": 0');
+ recordedMangledNames.add(className);
}
}

Powered by Google App Engine
This is Rietveld 408576698