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.constants.values; | 5 library dart2js.constants.values; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../core_types.dart'; | 8 import '../core_types.dart'; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../elements/elements.dart' | 10 import '../elements/elements.dart' |
(...skipping 10 matching lines...) Expand all Loading... |
21 R visitDouble(DoubleConstantValue constant, A arg); | 21 R visitDouble(DoubleConstantValue constant, A arg); |
22 R visitBool(BoolConstantValue constant, A arg); | 22 R visitBool(BoolConstantValue constant, A arg); |
23 R visitString(StringConstantValue constant, A arg); | 23 R visitString(StringConstantValue constant, A arg); |
24 R visitList(ListConstantValue constant, A arg); | 24 R visitList(ListConstantValue constant, A arg); |
25 R visitMap(MapConstantValue constant, A arg); | 25 R visitMap(MapConstantValue constant, A arg); |
26 R visitConstructed(ConstructedConstantValue constant, A arg); | 26 R visitConstructed(ConstructedConstantValue constant, A arg); |
27 R visitType(TypeConstantValue constant, A arg); | 27 R visitType(TypeConstantValue constant, A arg); |
28 R visitInterceptor(InterceptorConstantValue constant, A arg); | 28 R visitInterceptor(InterceptorConstantValue constant, A arg); |
29 R visitSynthetic(SyntheticConstantValue constant, A arg); | 29 R visitSynthetic(SyntheticConstantValue constant, A arg); |
30 R visitDeferred(DeferredConstantValue constant, A arg); | 30 R visitDeferred(DeferredConstantValue constant, A arg); |
31 R visitNonConstant(NonConstantValue constant, A arg); | |
32 } | 31 } |
33 | 32 |
34 abstract class ConstantValue { | 33 abstract class ConstantValue { |
35 const ConstantValue(); | 34 const ConstantValue(); |
36 | 35 |
37 /// `true` if this is a valid constant value. | 36 /// `true` if this is a valid constant value. |
38 bool get isConstant => true; | 37 bool get isConstant => true; |
39 | 38 |
40 bool get isNull => false; | 39 bool get isNull => false; |
41 bool get isBool => false; | 40 bool get isBool => false; |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 } | 755 } |
757 | 756 |
758 /// A constant value resulting from a non constant or erroneous constant | 757 /// A constant value resulting from a non constant or erroneous constant |
759 /// expression. | 758 /// expression. |
760 // TODO(johnniwinther): Expand this to contain the error kind. | 759 // TODO(johnniwinther): Expand this to contain the error kind. |
761 class NonConstantValue extends ConstantValue { | 760 class NonConstantValue extends ConstantValue { |
762 bool get isConstant => false; | 761 bool get isConstant => false; |
763 | 762 |
764 @override | 763 @override |
765 accept(ConstantValueVisitor visitor, arg) { | 764 accept(ConstantValueVisitor visitor, arg) { |
766 return visitor.visitNonConstant(this, arg); | 765 // TODO(johnniwinther): Should this be part of the visiting? |
767 } | 766 } |
768 | 767 |
769 @override | 768 @override |
770 List<ConstantValue> getDependencies() => const <ConstantValue>[]; | 769 List<ConstantValue> getDependencies() => const <ConstantValue>[]; |
771 | 770 |
772 @override | 771 @override |
773 DartType getType(CoreTypes types) => const DynamicType(); | 772 DartType getType(CoreTypes types) => const DynamicType(); |
774 | 773 |
775 @override | 774 @override |
776 String toStructuredText() => 'NonConstant'; | 775 String toStructuredText() => 'NonConstant'; |
777 | 776 |
778 @override | 777 @override |
779 String toDartText() => '>>non-constant<<'; | 778 String toDartText() => '>>non-constant<<'; |
780 } | 779 } |
OLD | NEW |