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 'common/backend_api.dart' show BackendClasses; | |
8 import 'constants/constant_system.dart'; | 7 import 'constants/constant_system.dart'; |
9 import 'constants/values.dart'; | 8 import 'constants/values.dart'; |
10 import 'common_elements.dart' show CommonElements; | 9 import 'common_elements.dart' show CommonElements; |
11 import 'elements/types.dart'; | 10 import 'elements/types.dart'; |
12 import 'elements/resolution_types.dart' show DartTypes; | 11 import 'elements/resolution_types.dart' show DartTypes; |
13 import 'tree/dartstring.dart' show DartString; | 12 import 'tree/dartstring.dart' show DartString; |
14 | 13 |
15 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); | 14 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); |
16 | 15 |
17 class BitNotOperation implements UnaryOperation { | 16 class BitNotOperation implements UnaryOperation { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 441 |
443 @override | 442 @override |
444 NullConstantValue createNull() => new NullConstantValue(); | 443 NullConstantValue createNull() => new NullConstantValue(); |
445 | 444 |
446 @override | 445 @override |
447 ListConstantValue createList(InterfaceType type, List<ConstantValue> values) { | 446 ListConstantValue createList(InterfaceType type, List<ConstantValue> values) { |
448 return new ListConstantValue(type, values); | 447 return new ListConstantValue(type, values); |
449 } | 448 } |
450 | 449 |
451 @override | 450 @override |
452 MapConstantValue createMap( | 451 MapConstantValue createMap(CommonElements commonElements, InterfaceType type, |
453 CommonElements commonElements, | 452 List<ConstantValue> keys, List<ConstantValue> values) { |
454 BackendClasses backendClasses, | |
455 InterfaceType type, | |
456 List<ConstantValue> keys, | |
457 List<ConstantValue> values) { | |
458 return new MapConstantValue(type, keys, values); | 453 return new MapConstantValue(type, keys, values); |
459 } | 454 } |
460 | 455 |
461 @override | 456 @override |
462 ConstantValue createType(CommonElements commonElements, | 457 ConstantValue createType(CommonElements commonElements, DartType type) { |
463 BackendClasses backendClasses, DartType type) { | 458 InterfaceType implementationType = commonElements.typeLiteralType; |
464 // TODO(johnniwinther): Change the `Type` type to | |
465 // `compiler.commonElements.typeType` and check the backend specific value | |
466 // in [checkConstMapKeysDontOverrideEquals] in 'members.dart'. | |
467 InterfaceType implementationType = backendClasses.typeType; | |
468 return new TypeConstantValue(type, implementationType); | 459 return new TypeConstantValue(type, implementationType); |
469 } | 460 } |
470 | 461 |
471 @override | 462 @override |
472 ConstantValue createSymbol(CommonElements commonElements, | 463 ConstantValue createSymbol(CommonElements commonElements, String text) { |
473 BackendClasses backendClasses, String text) { | |
474 throw new UnsupportedError('DartConstantSystem.createSymbol'); | 464 throw new UnsupportedError('DartConstantSystem.createSymbol'); |
475 } | 465 } |
476 | 466 |
477 bool isInt(ConstantValue constant) => constant.isInt; | 467 bool isInt(ConstantValue constant) => constant.isInt; |
478 bool isDouble(ConstantValue constant) => constant.isDouble; | 468 bool isDouble(ConstantValue constant) => constant.isDouble; |
479 bool isString(ConstantValue constant) => constant.isString; | 469 bool isString(ConstantValue constant) => constant.isString; |
480 bool isBool(ConstantValue constant) => constant.isBool; | 470 bool isBool(ConstantValue constant) => constant.isBool; |
481 bool isNull(ConstantValue constant) => constant.isNull; | 471 bool isNull(ConstantValue constant) => constant.isNull; |
482 | 472 |
483 bool isSubtype(DartTypes types, DartType s, DartType t) { | 473 bool isSubtype(DartTypes types, DartType s, DartType t) { |
484 return types.isSubtype(s, t); | 474 return types.isSubtype(s, t); |
485 } | 475 } |
486 } | 476 } |
OLD | NEW |