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 library dart2js.constant_system.dart; |
| 6 |
| 7 import 'constants/constant_system.dart'; |
| 8 import 'constants/values.dart'; |
| 9 import 'dart2jslib.dart' show Compiler; |
| 10 import 'dart_types.dart'; |
| 11 import 'tree/tree.dart' show DartString; |
6 | 12 |
7 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); | 13 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); |
8 | 14 |
9 class BitNotOperation implements UnaryOperation { | 15 class BitNotOperation implements UnaryOperation { |
10 final String name = '~'; | 16 final String name = '~'; |
11 const BitNotOperation(); | 17 const BitNotOperation(); |
12 ConstantValue fold(ConstantValue constant) { | 18 ConstantValue fold(ConstantValue constant) { |
13 if (constant.isInt) { | 19 if (constant.isInt) { |
14 IntConstantValue intConstant = constant; | 20 IntConstantValue intConstant = constant; |
15 return DART_CONSTANT_SYSTEM.createInt(~intConstant.primitiveValue); | 21 return DART_CONSTANT_SYSTEM.createInt(~intConstant.primitiveValue); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 bool isInt(ConstantValue constant) => constant.isInt; | 411 bool isInt(ConstantValue constant) => constant.isInt; |
406 bool isDouble(ConstantValue constant) => constant.isDouble; | 412 bool isDouble(ConstantValue constant) => constant.isDouble; |
407 bool isString(ConstantValue constant) => constant.isString; | 413 bool isString(ConstantValue constant) => constant.isString; |
408 bool isBool(ConstantValue constant) => constant.isBool; | 414 bool isBool(ConstantValue constant) => constant.isBool; |
409 bool isNull(ConstantValue constant) => constant.isNull; | 415 bool isNull(ConstantValue constant) => constant.isNull; |
410 | 416 |
411 bool isSubtype(DartTypes types, DartType s, DartType t) { | 417 bool isSubtype(DartTypes types, DartType s, DartType t) { |
412 return types.isSubtype(s, t); | 418 return types.isSubtype(s, t); |
413 } | 419 } |
414 } | 420 } |
OLD | NEW |