Index: dart/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart |
diff --git a/dart/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/dart/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart |
index 89c4d2bc951befc98b8d5dc1d0f42acfc463ff8a..6df667c9e6849be2954751a14032053687653c82 100644 |
--- a/dart/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart |
+++ b/dart/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart |
@@ -1110,10 +1110,7 @@ class OldEmitter implements Emitter { |
if (cachedEmittedConstants.contains(constant)) continue; |
cachedEmittedConstants.add(constant); |
} |
- String name = namer.constantName(constant); |
- jsAst.Expression init = js('#.# = #', |
- [namer.globalObjectForConstant(constant), name, |
- constantInitializerExpression(constant)]); |
+ jsAst.Expression init = buildConstantInitializer(constant); |
buffer.write(jsAst.prettyPrint(init, compiler, |
monitor: compiler.dumpInfoTask)); |
buffer.write('$N'); |
@@ -1123,6 +1120,13 @@ class OldEmitter implements Emitter { |
} |
} |
+ jsAst.Expression buildConstantInitializer(ConstantValue constant) { |
+ String name = namer.constantName(constant); |
+ return js('#.# = #', |
+ [namer.globalObjectForConstant(constant), name, |
+ constantInitializerExpression(constant)]); |
+ } |
+ |
jsAst.Template get makeConstantListTemplate { |
// TODO(floitsch): there is no harm in caching the template. |
return jsAst.js.uncachedExpressionTemplate( |