| 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.constant_system; | 5 library dart2js.constant_system; |
| 6 | 6 |
| 7 import '../common_elements.dart' show CommonElements; | 7 import '../common_elements.dart' show CommonElements; |
| 8 import '../elements/operators.dart'; | 8 import '../elements/operators.dart'; |
| 9 import '../elements/types.dart'; | 9 import '../elements/types.dart'; |
| 10 import '../tree/dartstring.dart' show DartString; | |
| 11 import 'values.dart'; | 10 import 'values.dart'; |
| 12 | 11 |
| 13 abstract class Operation { | 12 abstract class Operation { |
| 14 String get name; | 13 String get name; |
| 15 } | 14 } |
| 16 | 15 |
| 17 abstract class UnaryOperation extends Operation { | 16 abstract class UnaryOperation extends Operation { |
| 18 /** Returns [:null:] if it was unable to fold the operation. */ | 17 /** Returns [:null:] if it was unable to fold the operation. */ |
| 19 ConstantValue fold(ConstantValue constant); | 18 ConstantValue fold(ConstantValue constant); |
| 20 } | 19 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 BinaryOperation get subtract; | 53 BinaryOperation get subtract; |
| 55 BinaryOperation get truncatingDivide; | 54 BinaryOperation get truncatingDivide; |
| 56 | 55 |
| 57 BinaryOperation get codeUnitAt; | 56 BinaryOperation get codeUnitAt; |
| 58 UnaryOperation get round; | 57 UnaryOperation get round; |
| 59 | 58 |
| 60 const ConstantSystem(); | 59 const ConstantSystem(); |
| 61 | 60 |
| 62 ConstantValue createInt(int i); | 61 ConstantValue createInt(int i); |
| 63 ConstantValue createDouble(double d); | 62 ConstantValue createDouble(double d); |
| 64 ConstantValue createString(DartString string); | 63 ConstantValue createString(String string); |
| 65 ConstantValue createBool(bool value); | 64 ConstantValue createBool(bool value); |
| 66 ConstantValue createNull(); | 65 ConstantValue createNull(); |
| 67 ConstantValue createList(InterfaceType type, List<ConstantValue> values); | 66 ConstantValue createList(InterfaceType type, List<ConstantValue> values); |
| 68 ConstantValue createMap(CommonElements commonElements, InterfaceType type, | 67 ConstantValue createMap(CommonElements commonElements, InterfaceType type, |
| 69 List<ConstantValue> keys, List<ConstantValue> values); | 68 List<ConstantValue> keys, List<ConstantValue> values); |
| 70 ConstantValue createType(CommonElements commonElements, DartType type); | 69 ConstantValue createType(CommonElements commonElements, DartType type); |
| 71 ConstantValue createSymbol(CommonElements commonElements, String text); | 70 ConstantValue createSymbol(CommonElements commonElements, String text); |
| 72 | 71 |
| 73 // We need to special case the subtype check for JavaScript constant | 72 // We need to special case the subtype check for JavaScript constant |
| 74 // system because an int is a double at runtime. | 73 // system because an int is a double at runtime. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 return greaterEqual; | 135 return greaterEqual; |
| 137 case BinaryOperatorKind.EQ: | 136 case BinaryOperatorKind.EQ: |
| 138 return equal; | 137 return equal; |
| 139 case BinaryOperatorKind.IF_NULL: | 138 case BinaryOperatorKind.IF_NULL: |
| 140 return ifNull; | 139 return ifNull; |
| 141 default: | 140 default: |
| 142 return null; | 141 return null; |
| 143 } | 142 } |
| 144 } | 143 } |
| 145 } | 144 } |
| OLD | NEW |