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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart

Issue 22835003: Put constants in 'C', not '$'. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of js_backend; 5 part of js_backend;
6 6
7 class ConstantEmitter { 7 class ConstantEmitter {
8 ConstantReferenceEmitter _referenceEmitter; 8 ConstantReferenceEmitter _referenceEmitter;
9 ConstantInitializerEmitter _initializerEmitter; 9 ConstantInitializerEmitter _initializerEmitter;
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // then it should be assigned to a name. We don't have reference counts (or 115 // then it should be assigned to a name. We don't have reference counts (or
116 // profile information) here, so this is the wrong place. 116 // profile information) here, so this is the wrong place.
117 StringBuffer sb = new StringBuffer(); 117 StringBuffer sb = new StringBuffer();
118 writeJsonEscapedCharsOn(constant.value.slowToString(), sb); 118 writeJsonEscapedCharsOn(constant.value.slowToString(), sb);
119 return new jsAst.LiteralString('"$sb"'); 119 return new jsAst.LiteralString('"$sb"');
120 } 120 }
121 121
122 jsAst.Expression emitCanonicalVersion(Constant constant) { 122 jsAst.Expression emitCanonicalVersion(Constant constant) {
123 String name = namer.constantName(constant); 123 String name = namer.constantName(constant);
124 return new jsAst.PropertyAccess.field( 124 return new jsAst.PropertyAccess.field(
125 new jsAst.VariableUse(namer.CURRENT_ISOLATE), name); 125 new jsAst.VariableUse(namer.globalObjectForConstant(constant)), name);
126 } 126 }
127 127
128 jsAst.Expression visitList(ListConstant constant) { 128 jsAst.Expression visitList(ListConstant constant) {
129 return emitCanonicalVersion(constant); 129 return emitCanonicalVersion(constant);
130 } 130 }
131 131
132 jsAst.Expression visitMap(MapConstant constant) { 132 jsAst.Expression visitMap(MapConstant constant) {
133 return emitCanonicalVersion(constant); 133 return emitCanonicalVersion(constant);
134 } 134 }
135 135
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 .toList(growable: false) 324 .toList(growable: false)
325 .map((DartType type) => rti.getTypeRepresentation(type, (_){})); 325 .map((DartType type) => rti.getTypeRepresentation(type, (_){}));
326 jsAst.Expression argumentList = 326 jsAst.Expression argumentList =
327 new jsAst.LiteralString('[${arguments.join(', ')}]'); 327 new jsAst.LiteralString('[${arguments.join(', ')}]');
328 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()), 328 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()),
329 [value, argumentList]); 329 [value, argumentList]);
330 } 330 }
331 return value; 331 return value;
332 } 332 }
333 } 333 }
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698