| 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 library dart2js.compile_time_constant_evaluator; | 5 library dart2js.compile_time_constant_evaluator; |
| 6 | 6 |
| 7 import 'common/resolution.dart' show Resolution; | 7 import 'common/resolution.dart' show Resolution; |
| 8 import 'common/tasks.dart' show CompilerTask, Measurer; | 8 import 'common/tasks.dart' show CompilerTask, Measurer; |
| 9 import 'common.dart'; | 9 import 'common.dart'; |
| 10 import 'compiler.dart' show Compiler; | 10 import 'compiler.dart' show Compiler; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 new DartString.concat(accumulator, partStringValue.primitiveValue); | 579 new DartString.concat(accumulator, partStringValue.primitiveValue); |
| 580 } | 580 } |
| 581 return new AstConstant( | 581 return new AstConstant( |
| 582 context, | 582 context, |
| 583 node, | 583 node, |
| 584 new ConcatenateConstantExpression(subexpressions), | 584 new ConcatenateConstantExpression(subexpressions), |
| 585 constantSystem.createString(accumulator)); | 585 constantSystem.createString(accumulator)); |
| 586 } | 586 } |
| 587 | 587 |
| 588 AstConstant visitLiteralSymbol(LiteralSymbol node) { | 588 AstConstant visitLiteralSymbol(LiteralSymbol node) { |
| 589 ResolutionInterfaceType type = commonElements.symbolType; | 589 ResolutionInterfaceType type = commonElements.symbolImplementationType; |
| 590 String text = node.slowNameString; | 590 String text = node.slowNameString; |
| 591 List<AstConstant> arguments = <AstConstant>[ | 591 List<AstConstant> arguments = <AstConstant>[ |
| 592 new AstConstant(context, node, new StringConstantExpression(text), | 592 new AstConstant(context, node, new StringConstantExpression(text), |
| 593 constantSystem.createString(new LiteralDartString(text))) | 593 constantSystem.createString(new LiteralDartString(text))) |
| 594 ]; | 594 ]; |
| 595 ConstructorElement constructor = compiler.commonElements.symbolConstructor; | 595 ConstructorElement constructor = |
| 596 compiler.commonElements.symbolConstructorTarget; |
| 596 AstConstant constant = createConstructorInvocation( | 597 AstConstant constant = createConstructorInvocation( |
| 597 node, type, constructor, CallStructure.ONE_ARG, | 598 node, type, constructor, CallStructure.ONE_ARG, |
| 598 normalizedArguments: arguments); | 599 normalizedArguments: arguments); |
| 599 return new AstConstant( | 600 return new AstConstant( |
| 600 context, node, new SymbolConstantExpression(text), constant.value); | 601 context, node, new SymbolConstantExpression(text), constant.value); |
| 601 } | 602 } |
| 602 | 603 |
| 603 ConstantValue makeTypeConstant(ResolutionDartType elementType) { | 604 ConstantValue makeTypeConstant(ResolutionDartType elementType) { |
| 604 return constantSystem.createType(compiler.commonElements, elementType); | 605 return constantSystem.createType(compiler.commonElements, elementType); |
| 605 } | 606 } |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 @override | 1469 @override |
| 1469 ConstantExpression getFieldConstant(FieldElement field) { | 1470 ConstantExpression getFieldConstant(FieldElement field) { |
| 1470 return field.constant; | 1471 return field.constant; |
| 1471 } | 1472 } |
| 1472 | 1473 |
| 1473 @override | 1474 @override |
| 1474 ConstantExpression getLocalConstant(LocalVariableElement local) { | 1475 ConstantExpression getLocalConstant(LocalVariableElement local) { |
| 1475 return local.constant; | 1476 return local.constant; |
| 1476 } | 1477 } |
| 1477 } | 1478 } |
| OLD | NEW |