| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 jsAst.Expression generateInInitializationContext(Constant constant) { | 56 jsAst.Expression generateInInitializationContext(Constant constant) { |
| 57 return _visit(constant); | 57 return _visit(constant); |
| 58 } | 58 } |
| 59 | 59 |
| 60 jsAst.Expression _visit(Constant constant) { | 60 jsAst.Expression _visit(Constant constant) { |
| 61 return constant.accept(this); | 61 return constant.accept(this); |
| 62 } | 62 } |
| 63 | 63 |
| 64 jsAst.Expression visitSentinel(SentinelConstant constant) { | |
| 65 return new jsAst.VariableUse(namer.CURRENT_ISOLATE); | |
| 66 } | |
| 67 | |
| 68 jsAst.Expression visitFunction(FunctionConstant constant) { | 64 jsAst.Expression visitFunction(FunctionConstant constant) { |
| 69 return new jsAst.VariableUse( | 65 return new jsAst.VariableUse( |
| 70 namer.isolateStaticClosureAccess(constant.element)); | 66 namer.isolateStaticClosureAccess(constant.element)); |
| 71 } | 67 } |
| 72 | 68 |
| 73 jsAst.Expression visitNull(NullConstant constant) { | 69 jsAst.Expression visitNull(NullConstant constant) { |
| 74 return new jsAst.LiteralNull(); | 70 return new jsAst.LiteralNull(); |
| 75 } | 71 } |
| 76 | 72 |
| 77 jsAst.Expression visitInt(IntConstant constant) { | 73 jsAst.Expression visitInt(IntConstant constant) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 162 } |
| 167 | 163 |
| 168 jsAst.Expression _visit(Constant constant) { | 164 jsAst.Expression _visit(Constant constant) { |
| 169 return constant.accept(this); | 165 return constant.accept(this); |
| 170 } | 166 } |
| 171 | 167 |
| 172 jsAst.Expression _reference(Constant constant) { | 168 jsAst.Expression _reference(Constant constant) { |
| 173 return referenceEmitter.generateInInitializationContext(constant); | 169 return referenceEmitter.generateInInitializationContext(constant); |
| 174 } | 170 } |
| 175 | 171 |
| 176 jsAst.Expression visitSentinel(SentinelConstant constant) { | |
| 177 compiler.internalError( | |
| 178 "The parameter sentinel constant does not need specific JS code"); | |
| 179 } | |
| 180 | |
| 181 jsAst.Expression visitFunction(FunctionConstant constant) { | 172 jsAst.Expression visitFunction(FunctionConstant constant) { |
| 182 compiler.internalError( | 173 compiler.internalError( |
| 183 "The function constant does not need specific JS code"); | 174 "The function constant does not need specific JS code"); |
| 184 } | 175 } |
| 185 | 176 |
| 186 jsAst.Expression visitNull(NullConstant constant) { | 177 jsAst.Expression visitNull(NullConstant constant) { |
| 187 return _reference(constant); | 178 return _reference(constant); |
| 188 } | 179 } |
| 189 | 180 |
| 190 jsAst.Expression visitInt(IntConstant constant) { | 181 jsAst.Expression visitInt(IntConstant constant) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 .toList(growable: false) | 324 .toList(growable: false) |
| 334 .map((DartType type) => rti.getTypeRepresentation(type, (_){})); | 325 .map((DartType type) => rti.getTypeRepresentation(type, (_){})); |
| 335 jsAst.Expression argumentList = | 326 jsAst.Expression argumentList = |
| 336 new jsAst.LiteralString('[${arguments.join(', ')}]'); | 327 new jsAst.LiteralString('[${arguments.join(', ')}]'); |
| 337 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()), | 328 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()), |
| 338 [value, argumentList]); | 329 [value, argumentList]); |
| 339 } | 330 } |
| 340 return value; | 331 return value; |
| 341 } | 332 } |
| 342 } | 333 } |
| OLD | NEW |