| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 List<Constant> createArguments(_) { | 480 List<Constant> createArguments(_) { |
| 481 return [constantSystem.createString( | 481 return [constantSystem.createString( |
| 482 new DartString.literal(node.slowNameString), node)]; | 482 new DartString.literal(node.slowNameString), node)]; |
| 483 } | 483 } |
| 484 return makeConstructedConstant( | 484 return makeConstructedConstant( |
| 485 node, type, compiler.symbolConstructor, createArguments); | 485 node, type, compiler.symbolConstructor, createArguments); |
| 486 } | 486 } |
| 487 | 487 |
| 488 Constant makeTypeConstant(Element element) { | 488 Constant makeTypeConstant(Element element) { |
| 489 DartType elementType = element.computeType(compiler).asRaw(); | 489 DartType elementType = element.computeType(compiler).asRaw(); |
| 490 compiler.backend.registerTypeLiteral(element, elements); | 490 compiler.backend.registerTypeLiteral( |
| 491 element, compiler.enqueuer.codegen, elements); |
| 491 DartType constantType = | 492 DartType constantType = |
| 492 compiler.backend.typeImplementation.computeType(compiler); | 493 compiler.backend.typeImplementation.computeType(compiler); |
| 493 Constant constant = new TypeConstant(elementType, constantType); | 494 Constant constant = new TypeConstant(elementType, constantType); |
| 494 // If we use a type literal in a constant, the compile time | 495 // If we use a type literal in a constant, the compile time |
| 495 // constant emitter will generate a call to the createRuntimeType | 496 // constant emitter will generate a call to the createRuntimeType |
| 496 // helper so we register a use of that. | 497 // helper so we register a use of that. |
| 497 handler.registerCreateRuntimeTypeFunction(); | 498 handler.registerCreateRuntimeTypeFunction(); |
| 498 handler.registerCompileTimeConstant(constant, elements); | 499 handler.registerCompileTimeConstant(constant, elements); |
| 499 return constant; | 500 return constant; |
| 500 } | 501 } |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 if (fieldValue == null) { | 950 if (fieldValue == null) { |
| 950 // Use the default value. | 951 // Use the default value. |
| 951 fieldValue = handler.compileConstant(field); | 952 fieldValue = handler.compileConstant(field); |
| 952 } | 953 } |
| 953 jsNewArguments.add(fieldValue); | 954 jsNewArguments.add(fieldValue); |
| 954 }, | 955 }, |
| 955 includeSuperAndInjectedMembers: true); | 956 includeSuperAndInjectedMembers: true); |
| 956 return jsNewArguments; | 957 return jsNewArguments; |
| 957 } | 958 } |
| 958 } | 959 } |
| OLD | NEW |