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 '../common_elements.dart'; | 9 import '../common_elements.dart'; |
10 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 commonElements.symbolType; | 731 commonElements.symbolType; |
732 } | 732 } |
733 | 733 |
734 /// Type literal. | 734 /// Type literal. |
735 class TypeConstantExpression extends ConstantExpression { | 735 class TypeConstantExpression extends ConstantExpression { |
736 /// Either [DynamicType] or a raw [GenericType]. | 736 /// Either [DynamicType] or a raw [GenericType]. |
737 final DartType type; | 737 final DartType type; |
738 final String name; | 738 final String name; |
739 | 739 |
740 TypeConstantExpression(this.type, this.name) { | 740 TypeConstantExpression(this.type, this.name) { |
741 assert(type.isInterfaceType || | 741 assert( |
742 type.isTypedef || | 742 type.isInterfaceType || |
743 type.isFunctionType || | 743 type.isTypedef || |
744 type.isDynamic); | 744 type.isFunctionType || |
| 745 type.isDynamic, |
| 746 "Unexpected type constant type: $type"); |
745 } | 747 } |
746 | 748 |
747 ConstantExpressionKind get kind => ConstantExpressionKind.TYPE; | 749 ConstantExpressionKind get kind => ConstantExpressionKind.TYPE; |
748 | 750 |
749 accept(ConstantExpressionVisitor visitor, [context]) { | 751 accept(ConstantExpressionVisitor visitor, [context]) { |
750 return visitor.visitType(this, context); | 752 return visitor.visitType(this, context); |
751 } | 753 } |
752 | 754 |
753 @override | 755 @override |
754 void _createStructuredText(StringBuffer sb) { | 756 void _createStructuredText(StringBuffer sb) { |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 visit(exp.name); | 1927 visit(exp.name); |
1926 if (exp.defaultValue != null) { | 1928 if (exp.defaultValue != null) { |
1927 sb.write(', defaultValue: '); | 1929 sb.write(', defaultValue: '); |
1928 visit(exp.defaultValue); | 1930 visit(exp.defaultValue); |
1929 } | 1931 } |
1930 sb.write(')'); | 1932 sb.write(')'); |
1931 } | 1933 } |
1932 | 1934 |
1933 String toString() => sb.toString(); | 1935 String toString() => sb.toString(); |
1934 } | 1936 } |
OLD | NEW |