| 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 dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The [ConstantHandler] keeps track of compile-time constants, | 8 * The [ConstantHandler] keeps track of compile-time constants, |
| 9 * initializations of global and static fields, and default values of | 9 * initializations of global and static fields, and default values of |
| 10 * optional parameters. | 10 * optional parameters. |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 isEvaluatingConstant = oldIsEvaluatingConstant; | 307 isEvaluatingConstant = oldIsEvaluatingConstant; |
| 308 assert(result != null); | 308 assert(result != null); |
| 309 return result; | 309 return result; |
| 310 } | 310 } |
| 311 | 311 |
| 312 Constant visitNode(Node node) { | 312 Constant visitNode(Node node) { |
| 313 return signalNotCompileTimeConstant(node); | 313 return signalNotCompileTimeConstant(node); |
| 314 } | 314 } |
| 315 | 315 |
| 316 Constant visitLiteralBool(LiteralBool node) { | 316 Constant visitLiteralBool(LiteralBool node) { |
| 317 handler.registerInstantiatedClass(compiler.boolClass); |
| 317 return constantSystem.createBool(node.value); | 318 return constantSystem.createBool(node.value); |
| 318 } | 319 } |
| 319 | 320 |
| 320 Constant visitLiteralDouble(LiteralDouble node) { | 321 Constant visitLiteralDouble(LiteralDouble node) { |
| 322 handler.registerInstantiatedClass(compiler.doubleClass); |
| 321 return constantSystem.createDouble(node.value); | 323 return constantSystem.createDouble(node.value); |
| 322 } | 324 } |
| 323 | 325 |
| 324 Constant visitLiteralInt(LiteralInt node) { | 326 Constant visitLiteralInt(LiteralInt node) { |
| 327 handler.registerInstantiatedClass(compiler.intClass); |
| 325 return constantSystem.createInt(node.value); | 328 return constantSystem.createInt(node.value); |
| 326 } | 329 } |
| 327 | 330 |
| 328 Constant visitLiteralList(LiteralList node) { | 331 Constant visitLiteralList(LiteralList node) { |
| 329 if (!node.isConst()) { | 332 if (!node.isConst()) { |
| 330 return signalNotCompileTimeConstant(node); | 333 return signalNotCompileTimeConstant(node); |
| 331 } | 334 } |
| 332 List<Constant> arguments = <Constant>[]; | 335 List<Constant> arguments = <Constant>[]; |
| 333 for (Link<Node> link = node.elements.nodes; | 336 for (Link<Node> link = node.elements.nodes; |
| 334 !link.isEmpty; | 337 !link.isEmpty; |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 // Use the default value. | 873 // Use the default value. |
| 871 fieldValue = handler.compileConstant(field); | 874 fieldValue = handler.compileConstant(field); |
| 872 } | 875 } |
| 873 jsNewArguments.add(fieldValue); | 876 jsNewArguments.add(fieldValue); |
| 874 }, | 877 }, |
| 875 includeBackendMembers: true, | 878 includeBackendMembers: true, |
| 876 includeSuperMembers: true); | 879 includeSuperMembers: true); |
| 877 return jsNewArguments; | 880 return jsNewArguments; |
| 878 } | 881 } |
| 879 } | 882 } |
| OLD | NEW |