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

Side by Side Diff: lib/compiler/implementation/emitter.dart

Issue 9967001: Fix bug where constants were not correctly canonicalized. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } else { 140 } else {
141 Constant value = handler.initialVariableValues[element]; 141 Constant value = handler.initialVariableValues[element];
142 if (value == null) { 142 if (value == null) {
143 argumentsBuffer[count] = '(void 0)'; 143 argumentsBuffer[count] = '(void 0)';
144 } else { 144 } else {
145 if (!value.isNull()) { 145 if (!value.isNull()) {
146 // If the value is the null constant, we should not pass it 146 // If the value is the null constant, we should not pass it
147 // down to the native method. 147 // down to the native method.
148 indexOfLastOptionalArgumentInParameters = count; 148 indexOfLastOptionalArgumentInParameters = count;
149 } 149 }
150 argumentsBuffer[count] = 150 StringBuffer argumentBuffer = new StringBuffer();
151 handler.writeJsCode(new StringBuffer(), value).toString(); 151 handler.writeCanonicalizedJsCode(argumentBuffer, value);
152 argumentsBuffer[count] = argumentBuffer.toString();
152 } 153 }
153 } 154 }
154 } 155 }
155 count++; 156 count++;
156 }); 157 });
157 String parametersString = Strings.join(parametersBuffer, ","); 158 String parametersString = Strings.join(parametersBuffer, ",");
158 buffer.add('$parametersString) {\n'); 159 buffer.add('$parametersString) {\n');
159 160
160 if (isNative) { 161 if (isNative) {
161 nativeEmitter.emitParameterStub( 162 nativeEmitter.emitParameterStub(
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 nativeEmitter.emitDynamicDispatchMetadata(); 722 nativeEmitter.emitDynamicDispatchMetadata();
722 mainBuffer.add( 723 mainBuffer.add(
723 'var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); 724 'var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n');
724 nativeEmitter.assembleCode(mainBuffer); 725 nativeEmitter.assembleCode(mainBuffer);
725 emitMain(mainBuffer); 726 emitMain(mainBuffer);
726 compiler.assembledCode = mainBuffer.toString(); 727 compiler.assembledCode = mainBuffer.toString();
727 }); 728 });
728 return compiler.assembledCode; 729 return compiler.assembledCode;
729 } 730 }
730 } 731 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698