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

Unified Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart

Issue 1253443003: dart2js: Support const symbols in the startup emitter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update comment. Created 5 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: pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index 5bf5d697a34a4e36dea5227f55bbe321e2f75aaa..1eaaa8029015aed45aa77496d9c40fc9f6618d56 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -1120,10 +1120,17 @@ class FragmentEmitter {
globals.add(emitMangledGlobalNames());
- // The [MANGLED_NAMES] table is only relevant for reflection.
- // TODO(floitsch): verify that this is correct.
- globals.add(new js.Property(js.string(MANGLED_NAMES),
- new js.ObjectInitializer([])));
+ // The [MANGLED_NAMES] table must contain the mapping for const symbols.
+ // Without const symbols, the table is only relevant for reflection and
+ // therefore unused in this emitter.
+ List<js.Property> mangledNamesProperties = <js.Property>[];
+ program.symbolsMap.forEach((js.Name mangledName, String unmangledName) {
+ mangledNamesProperties.add(
+ new js.Property(mangledName, js.string(unmangledName)));
+ });
+ globals.add(new js.Property(
+ js.string(MANGLED_NAMES),
+ new js.ObjectInitializer(mangledNamesProperties)));
globals.add(emitGetTypeFromName());

Powered by Google App Engine
This is Rietveld 408576698