| 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 2bd01d4136b685df7d348fe7bffd17ed22be9fb9..4be2c83890fd8a4cd57c5e37dc3d93ebf2496d82 100644
|
| --- a/lib/compiler/implementation/js_backend/emitter.dart
|
| +++ b/lib/compiler/implementation/js_backend/emitter.dart
|
| @@ -34,7 +34,6 @@ class CodeEmitterTask extends CompilerTask {
|
| bool needsClosureClass = false;
|
| bool needsLazyInitializer = false;
|
| final Namer namer;
|
| - ConstantEmitter constantEmitter;
|
| NativeEmitter nativeEmitter;
|
| CodeBuffer boundClosureBuffer;
|
| CodeBuffer mainBuffer;
|
| @@ -46,27 +45,16 @@ class CodeEmitterTask extends CompilerTask {
|
|
|
| final bool generateSourceMap;
|
|
|
| - CodeEmitterTask(Compiler compiler, Namer namer,
|
| + CodeEmitterTask(Compiler compiler, this.namer,
|
| [bool generateSourceMap = false])
|
| : boundClosureBuffer = new CodeBuffer(),
|
| mainBuffer = new CodeBuffer(),
|
| - this.namer = namer,
|
| boundClosureCache = new Map<int, String>(),
|
| generateSourceMap = generateSourceMap,
|
| - constantEmitter = new ConstantEmitter(compiler, namer),
|
| super(compiler) {
|
| nativeEmitter = new NativeEmitter(this);
|
| }
|
|
|
| - void writeConstantToBuffer(Constant value, CodeBuffer buffer,
|
| - [emitCanonicalVersion = true]) {
|
| - if (emitCanonicalVersion) {
|
| - constantEmitter.emitCanonicalVersionOfConstant(value, buffer);
|
| - } else {
|
| - constantEmitter.emitJavaScriptCodeForConstant(value, buffer);
|
| - }
|
| - }
|
| -
|
| String get name => 'CodeEmitter';
|
|
|
| String get defineClassName
|
| @@ -410,7 +398,7 @@ function(prototype, staticName, fieldName, getterName, lazyValue) {
|
| // Note that [elements] may be null for a synthetized [member].
|
| } else if (elements != null && elements.isParameterChecked(element)) {
|
| CodeBuffer argumentBuffer = new CodeBuffer();
|
| - writeConstantToBuffer(SentinelConstant.SENTINEL, argumentBuffer);
|
| + handler.writeConstant(argumentBuffer, SentinelConstant.SENTINEL);
|
| argumentsBuffer[count] = argumentBuffer.toString();
|
| } else {
|
| Constant value = handler.initialVariableValues[element];
|
| @@ -423,7 +411,7 @@ function(prototype, staticName, fieldName, getterName, lazyValue) {
|
| indexOfLastOptionalArgumentInParameters = count;
|
| }
|
| CodeBuffer argumentBuffer = new CodeBuffer();
|
| - writeConstantToBuffer(value, argumentBuffer);
|
| + handler.writeConstant(argumentBuffer, value);
|
| argumentsBuffer[count] = argumentBuffer.toString();
|
| }
|
| }
|
| @@ -934,8 +922,7 @@ $classesCollector.$mangledName = {'':
|
| for (Element element in staticNonFinalFields) {
|
| buffer.add('$isolateProperties.${namer.getName(element)} = ');
|
| compiler.withCurrentElement(element, () {
|
| - Constant initialValue = handler.getInitialValueFor(element);
|
| - writeConstantToBuffer(initialValue, buffer);
|
| + handler.writeJsCodeForVariable(buffer, element);
|
| });
|
| buffer.add(';\n');
|
| }
|
| @@ -976,10 +963,7 @@ $classesCollector.$mangledName = {'':
|
| List<Constant> constants = handler.getConstantsForEmission();
|
| bool addedMakeConstantList = false;
|
| for (Constant constant in constants) {
|
| - // No need to emit functions. We already did that.
|
| - if (constant.isFunction()) continue;
|
| -
|
| - String name = namer.constantName(constant);
|
| + String name = handler.getNameForConstant(constant);
|
| // The name is null when the constant is already a JS constant.
|
| // TODO(floitsch): every constant should be registered, so that we can
|
| // share the ones that take up too much space (like some strings).
|
| @@ -989,7 +973,7 @@ $classesCollector.$mangledName = {'':
|
| emitMakeConstantList(buffer);
|
| }
|
| buffer.add('$isolateProperties.$name = ');
|
| - writeConstantToBuffer(constant, buffer, emitCanonicalVersion: false);
|
| + handler.writeJsCode(buffer, constant);
|
| buffer.add(';\n');
|
| }
|
| }
|
|
|