| 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 '../dart_types.dart'; | 7 import '../dart_types.dart'; |
| 8 import '../compiler.dart' show | 8 import '../compiler.dart' show |
| 9 Compiler; | 9 Compiler; |
| 10 import '../resolution/operators.dart'; | 10 import '../resolution/operators.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 BinaryOperation get equal; | 42 BinaryOperation get equal; |
| 43 BinaryOperation get greaterEqual; | 43 BinaryOperation get greaterEqual; |
| 44 BinaryOperation get greater; | 44 BinaryOperation get greater; |
| 45 BinaryOperation get identity; | 45 BinaryOperation get identity; |
| 46 BinaryOperation get lessEqual; | 46 BinaryOperation get lessEqual; |
| 47 BinaryOperation get less; | 47 BinaryOperation get less; |
| 48 BinaryOperation get modulo; | 48 BinaryOperation get modulo; |
| 49 BinaryOperation get multiply; | 49 BinaryOperation get multiply; |
| 50 UnaryOperation get negate; | 50 UnaryOperation get negate; |
| 51 UnaryOperation get not; | 51 UnaryOperation get not; |
| 52 BinaryOperation get notEqual; |
| 52 BinaryOperation get shiftLeft; | 53 BinaryOperation get shiftLeft; |
| 53 BinaryOperation get shiftRight; | 54 BinaryOperation get shiftRight; |
| 54 BinaryOperation get subtract; | 55 BinaryOperation get subtract; |
| 55 BinaryOperation get truncatingDivide; | 56 BinaryOperation get truncatingDivide; |
| 56 | 57 |
| 57 BinaryOperation get codeUnitAt; | 58 BinaryOperation get codeUnitAt; |
| 58 | 59 |
| 59 const ConstantSystem(); | 60 const ConstantSystem(); |
| 60 | 61 |
| 61 ConstantValue createInt(int i); | 62 ConstantValue createInt(int i); |
| 62 ConstantValue createDouble(double d); | 63 ConstantValue createDouble(double d); |
| 63 ConstantValue createString(DartString string); | 64 ConstantValue createString(DartString string); |
| 64 ConstantValue createBool(bool value); | 65 ConstantValue createBool(bool value); |
| 65 ConstantValue createNull(); | 66 ConstantValue createNull(); |
| 66 ConstantValue createList(InterfaceType type, | 67 ConstantValue createList(InterfaceType type, |
| 67 List<ConstantValue> values); | 68 List<ConstantValue> values); |
| 68 // TODO(johnniwinther): Remove the need for [compiler]. | 69 // TODO(johnniwinther): Remove the need for [compiler]. |
| 69 ConstantValue createMap(Compiler compiler, | 70 ConstantValue createMap(Compiler compiler, |
| 70 InterfaceType type, | 71 InterfaceType type, |
| 71 List<ConstantValue> keys, | 72 List<ConstantValue> keys, |
| 72 List<ConstantValue> values); | 73 List<ConstantValue> values); |
| 73 // TODO(johnniwinther): Remove the need for [compiler]. | 74 // TODO(johnniwinther): Remove the need for [compiler]. |
| 74 ConstantValue createType(Compiler compiler, | 75 ConstantValue createType(Compiler compiler, |
| 75 DartType type); | 76 DartType type); |
| 77 ConstantValue createSymbol(Compiler compiler, String text); |
| 76 | 78 |
| 77 // We need to special case the subtype check for JavaScript constant | 79 // We need to special case the subtype check for JavaScript constant |
| 78 // system because an int is a double at runtime. | 80 // system because an int is a double at runtime. |
| 79 bool isSubtype(DartTypes types, DartType s, DartType t); | 81 bool isSubtype(DartTypes types, DartType s, DartType t); |
| 80 | 82 |
| 81 /** Returns true if the [constant] is an integer at runtime. */ | 83 /** Returns true if the [constant] is an integer at runtime. */ |
| 82 bool isInt(ConstantValue constant); | 84 bool isInt(ConstantValue constant); |
| 83 /** Returns true if the [constant] is a double at runtime. */ | 85 /** Returns true if the [constant] is a double at runtime. */ |
| 84 bool isDouble(ConstantValue constant); | 86 bool isDouble(ConstantValue constant); |
| 85 /** Returns true if the [constant] is a string at runtime. */ | 87 /** Returns true if the [constant] is a string at runtime. */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 111 case BinaryOperatorKind.XOR: return bitXor; | 113 case BinaryOperatorKind.XOR: return bitXor; |
| 112 case BinaryOperatorKind.LOGICAL_OR: return booleanOr; | 114 case BinaryOperatorKind.LOGICAL_OR: return booleanOr; |
| 113 case BinaryOperatorKind.LOGICAL_AND: return booleanAnd; | 115 case BinaryOperatorKind.LOGICAL_AND: return booleanAnd; |
| 114 case BinaryOperatorKind.SHL: return shiftLeft; | 116 case BinaryOperatorKind.SHL: return shiftLeft; |
| 115 case BinaryOperatorKind.SHR: return shiftRight; | 117 case BinaryOperatorKind.SHR: return shiftRight; |
| 116 case BinaryOperatorKind.LT: return less; | 118 case BinaryOperatorKind.LT: return less; |
| 117 case BinaryOperatorKind.LTEQ: return lessEqual; | 119 case BinaryOperatorKind.LTEQ: return lessEqual; |
| 118 case BinaryOperatorKind.GT: return greater; | 120 case BinaryOperatorKind.GT: return greater; |
| 119 case BinaryOperatorKind.GTEQ: return greaterEqual; | 121 case BinaryOperatorKind.GTEQ: return greaterEqual; |
| 120 case BinaryOperatorKind.EQ: return equal; | 122 case BinaryOperatorKind.EQ: return equal; |
| 123 case BinaryOperatorKind.NOT_EQ: return notEqual; |
| 121 default: return null; | 124 default: return null; |
| 122 } | 125 } |
| 123 } | 126 } |
| 124 } | 127 } |
| OLD | NEW |