OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.constants.expressions; | 5 library dart2js.constants.expressions; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../constants/constant_system.dart'; | 8 import '../constants/constant_system.dart'; |
9 import '../core_types.dart'; | 9 import '../core_types.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 int _computeHashCode() => 13 * name.hashCode; | 673 int _computeHashCode() => 13 * name.hashCode; |
674 | 674 |
675 @override | 675 @override |
676 bool _equals(SymbolConstantExpression other) { | 676 bool _equals(SymbolConstantExpression other) { |
677 return name == other.name; | 677 return name == other.name; |
678 } | 678 } |
679 | 679 |
680 @override | 680 @override |
681 ConstantValue evaluate( | 681 ConstantValue evaluate( |
682 Environment environment, ConstantSystem constantSystem) { | 682 Environment environment, ConstantSystem constantSystem) { |
683 // TODO(johnniwinther): Implement this. | 683 return constantSystem.createSymbol(environment.compiler, name); |
684 throw new UnsupportedError('SymbolConstantExpression.evaluate'); | |
685 } | 684 } |
686 | 685 |
687 @override | 686 @override |
688 DartType getKnownType(CoreTypes coreTypes) => coreTypes.symbolType; | 687 DartType getKnownType(CoreTypes coreTypes) => coreTypes.symbolType; |
689 } | 688 } |
690 | 689 |
691 /// Type literal. | 690 /// Type literal. |
692 class TypeConstantExpression extends ConstantExpression { | 691 class TypeConstantExpression extends ConstantExpression { |
693 /// Either [DynamicType] or a raw [GenericType]. | 692 /// Either [DynamicType] or a raw [GenericType]. |
694 final DartType type; | 693 final DartType type; |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 visit(exp.name); | 1759 visit(exp.name); |
1761 if (exp.defaultValue != null) { | 1760 if (exp.defaultValue != null) { |
1762 sb.write(', defaultValue: '); | 1761 sb.write(', defaultValue: '); |
1763 visit(exp.defaultValue); | 1762 visit(exp.defaultValue); |
1764 } | 1763 } |
1765 sb.write(')'); | 1764 sb.write(')'); |
1766 } | 1765 } |
1767 | 1766 |
1768 String toString() => sb.toString(); | 1767 String toString() => sb.toString(); |
1769 } | 1768 } |
OLD | NEW |