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.dart; | 5 library dart2js.constant_system.dart; |
6 | 6 |
7 import 'constants/constant_system.dart'; | 7 import 'constants/constant_system.dart'; |
8 import 'constants/values.dart'; | 8 import 'constants/values.dart'; |
9 import 'dart2jslib.dart' show Compiler; | 9 import 'dart2jslib.dart' show Compiler; |
10 import 'dart_types.dart'; | 10 import 'dart_types.dart'; |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 final negate = const NegateOperation(); | 387 final negate = const NegateOperation(); |
388 final not = const NotOperation(); | 388 final not = const NotOperation(); |
389 final shiftLeft = const ShiftLeftOperation(); | 389 final shiftLeft = const ShiftLeftOperation(); |
390 final shiftRight = const ShiftRightOperation(); | 390 final shiftRight = const ShiftRightOperation(); |
391 final subtract = const SubtractOperation(); | 391 final subtract = const SubtractOperation(); |
392 final truncatingDivide = const TruncatingDivideOperation(); | 392 final truncatingDivide = const TruncatingDivideOperation(); |
393 final codeUnitAt = const CodeUnitAtConstantOperation(); | 393 final codeUnitAt = const CodeUnitAtConstantOperation(); |
394 | 394 |
395 const DartConstantSystem(); | 395 const DartConstantSystem(); |
396 | 396 |
| 397 |
| 398 @override |
397 IntConstantValue createInt(int i) => new IntConstantValue(i); | 399 IntConstantValue createInt(int i) => new IntConstantValue(i); |
| 400 |
| 401 @override |
398 DoubleConstantValue createDouble(double d) => new DoubleConstantValue(d); | 402 DoubleConstantValue createDouble(double d) => new DoubleConstantValue(d); |
| 403 |
| 404 @override |
399 StringConstantValue createString(DartString string) { | 405 StringConstantValue createString(DartString string) { |
400 return new StringConstantValue(string); | 406 return new StringConstantValue(string); |
401 } | 407 } |
| 408 |
| 409 @override |
402 BoolConstantValue createBool(bool value) => new BoolConstantValue(value); | 410 BoolConstantValue createBool(bool value) => new BoolConstantValue(value); |
| 411 |
| 412 @override |
403 NullConstantValue createNull() => new NullConstantValue(); | 413 NullConstantValue createNull() => new NullConstantValue(); |
| 414 |
| 415 @override |
| 416 ListConstantValue createList(InterfaceType type, |
| 417 List<ConstantValue> values) { |
| 418 return new ListConstantValue(type, values); |
| 419 } |
| 420 |
| 421 @override |
404 MapConstantValue createMap(Compiler compiler, | 422 MapConstantValue createMap(Compiler compiler, |
405 InterfaceType type, | 423 InterfaceType type, |
406 List<ConstantValue> keys, | 424 List<ConstantValue> keys, |
407 List<ConstantValue> values) { | 425 List<ConstantValue> values) { |
408 return new MapConstantValue(type, keys, values); | 426 return new MapConstantValue(type, keys, values); |
409 } | 427 } |
410 | 428 |
| 429 @override |
| 430 ConstantValue createType(Compiler compiler, DartType type) { |
| 431 return new TypeConstantValue(type, compiler.coreTypes.typeType); |
| 432 } |
| 433 |
411 bool isInt(ConstantValue constant) => constant.isInt; | 434 bool isInt(ConstantValue constant) => constant.isInt; |
412 bool isDouble(ConstantValue constant) => constant.isDouble; | 435 bool isDouble(ConstantValue constant) => constant.isDouble; |
413 bool isString(ConstantValue constant) => constant.isString; | 436 bool isString(ConstantValue constant) => constant.isString; |
414 bool isBool(ConstantValue constant) => constant.isBool; | 437 bool isBool(ConstantValue constant) => constant.isBool; |
415 bool isNull(ConstantValue constant) => constant.isNull; | 438 bool isNull(ConstantValue constant) => constant.isNull; |
416 | 439 |
417 bool isSubtype(DartTypes types, DartType s, DartType t) { | 440 bool isSubtype(DartTypes types, DartType s, DartType t) { |
418 return types.isSubtype(s, t); | 441 return types.isSubtype(s, t); |
419 } | 442 } |
420 } | 443 } |
OLD | NEW |