OLD | NEW |
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 jsAst.Expression visitString(StringConstant constant) { | 206 jsAst.Expression visitString(StringConstant constant) { |
207 // TODO(sra): Some larger strings are worth sharing. | 207 // TODO(sra): Some larger strings are worth sharing. |
208 return _reference(constant); | 208 return _reference(constant); |
209 } | 209 } |
210 | 210 |
211 jsAst.Expression visitList(ListConstant constant) { | 211 jsAst.Expression visitList(ListConstant constant) { |
212 jsAst.Expression value = new jsAst.Call( | 212 jsAst.Expression value = new jsAst.Call( |
213 new jsAst.PropertyAccess.field( | 213 new jsAst.PropertyAccess.field( |
214 new jsAst.VariableUse(namer.isolateName), | 214 new jsAst.VariableUse(namer.isolateName), |
215 'makeConstantList'), | 215 namer.getMappedInstanceName('makeConstantList')), |
216 [new jsAst.ArrayInitializer.from(_array(constant.entries))]); | 216 [new jsAst.ArrayInitializer.from(_array(constant.entries))]); |
217 return maybeAddTypeArguments(constant.type, value); | 217 return maybeAddTypeArguments(constant.type, value); |
218 } | 218 } |
219 | 219 |
220 jsAst.Expression getJsConstructor(ClassElement element) { | 220 jsAst.Expression getJsConstructor(ClassElement element) { |
221 return namer.elementAccess(element); | 221 return namer.elementAccess(element); |
222 } | 222 } |
223 | 223 |
224 jsAst.Expression visitMap(MapConstant constant) { | 224 jsAst.Expression visitMap(MapConstant constant) { |
225 jsAst.Expression jsMap() { | 225 jsAst.Expression jsMap() { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 .map((DartType type) => | 357 .map((DartType type) => |
358 rti.getTypeRepresentationWithHashes(type, (_){})); | 358 rti.getTypeRepresentationWithHashes(type, (_){})); |
359 jsAst.Expression argumentList = | 359 jsAst.Expression argumentList = |
360 new jsAst.LiteralString('[${arguments.join(', ')}]'); | 360 new jsAst.LiteralString('[${arguments.join(', ')}]'); |
361 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()), | 361 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()), |
362 [value, argumentList]); | 362 [value, argumentList]); |
363 } | 363 } |
364 return value; | 364 return value; |
365 } | 365 } |
366 } | 366 } |
OLD | NEW |