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( | 741 assert(type.isInterfaceType || |
742 type.isInterfaceType || | 742 type.isTypedef || |
743 type.isTypedef || | 743 type.isFunctionType || |
744 type.isFunctionType || | 744 type.isDynamic); |
745 type.isDynamic, | |
746 "Unexpected type constant type: $type"); | |
747 } | 745 } |
748 | 746 |
749 ConstantExpressionKind get kind => ConstantExpressionKind.TYPE; | 747 ConstantExpressionKind get kind => ConstantExpressionKind.TYPE; |
750 | 748 |
751 accept(ConstantExpressionVisitor visitor, [context]) { | 749 accept(ConstantExpressionVisitor visitor, [context]) { |
752 return visitor.visitType(this, context); | 750 return visitor.visitType(this, context); |
753 } | 751 } |
754 | 752 |
755 @override | 753 @override |
756 void _createStructuredText(StringBuffer sb) { | 754 void _createStructuredText(StringBuffer sb) { |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 visit(exp.name); | 1925 visit(exp.name); |
1928 if (exp.defaultValue != null) { | 1926 if (exp.defaultValue != null) { |
1929 sb.write(', defaultValue: '); | 1927 sb.write(', defaultValue: '); |
1930 visit(exp.defaultValue); | 1928 visit(exp.defaultValue); |
1931 } | 1929 } |
1932 sb.write(')'); | 1930 sb.write(')'); |
1933 } | 1931 } |
1934 | 1932 |
1935 String toString() => sb.toString(); | 1933 String toString() => sb.toString(); |
1936 } | 1934 } |
OLD | NEW |