| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 accumulator = new DartString.concat(accumulator, expressionString); | 476 accumulator = new DartString.concat(accumulator, expressionString); |
| 477 StringConstant partString = evaluate(part.string); | 477 StringConstant partString = evaluate(part.string); |
| 478 if (partString == null) return null; | 478 if (partString == null) return null; |
| 479 accumulator = new DartString.concat(accumulator, partString.value); | 479 accumulator = new DartString.concat(accumulator, partString.value); |
| 480 }; | 480 }; |
| 481 handler.registerStringInstance(elements); | 481 handler.registerStringInstance(elements); |
| 482 return constantSystem.createString(accumulator, node); | 482 return constantSystem.createString(accumulator, node); |
| 483 } | 483 } |
| 484 | 484 |
| 485 Constant visitLiteralSymbol(LiteralSymbol node) { | 485 Constant visitLiteralSymbol(LiteralSymbol node) { |
| 486 handler.registerStringInstance(elements); |
| 486 InterfaceType type = compiler.symbolClass.computeType(compiler); | 487 InterfaceType type = compiler.symbolClass.computeType(compiler); |
| 487 List<Constant> createArguments(_) { | 488 List<Constant> createArguments(_) { |
| 488 return [constantSystem.createString( | 489 return [constantSystem.createString( |
| 489 new DartString.literal(node.slowNameString), node)]; | 490 new DartString.literal(node.slowNameString), node)]; |
| 490 } | 491 } |
| 491 return makeConstructedConstant( | 492 return makeConstructedConstant( |
| 492 node, type, compiler.symbolConstructor, createArguments); | 493 node, type, compiler.symbolConstructor, createArguments); |
| 493 } | 494 } |
| 494 | 495 |
| 495 Constant makeTypeConstant(Element element) { | 496 Constant makeTypeConstant(Element element) { |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 if (fieldValue == null) { | 961 if (fieldValue == null) { |
| 961 // Use the default value. | 962 // Use the default value. |
| 962 fieldValue = handler.compileConstant(field); | 963 fieldValue = handler.compileConstant(field); |
| 963 } | 964 } |
| 964 jsNewArguments.add(fieldValue); | 965 jsNewArguments.add(fieldValue); |
| 965 }, | 966 }, |
| 966 includeSuperAndInjectedMembers: true); | 967 includeSuperAndInjectedMembers: true); |
| 967 return jsNewArguments; | 968 return jsNewArguments; |
| 968 } | 969 } |
| 969 } | 970 } |
| OLD | NEW |