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); |
31 } | 32 } |
32 | 33 |
33 abstract class ConstantValue { | 34 abstract class ConstantValue { |
34 const ConstantValue(); | 35 const ConstantValue(); |
35 | 36 |
36 /// `true` if this is a valid constant value. | 37 /// `true` if this is a valid constant value. |
37 bool get isConstant => true; | 38 bool get isConstant => true; |
38 | 39 |
39 bool get isNull => false; | 40 bool get isNull => false; |
40 bool get isBool => false; | 41 bool get isBool => false; |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 } | 756 } |
756 | 757 |
757 /// A constant value resulting from a non constant or erroneous constant | 758 /// A constant value resulting from a non constant or erroneous constant |
758 /// expression. | 759 /// expression. |
759 // TODO(johnniwinther): Expand this to contain the error kind. | 760 // TODO(johnniwinther): Expand this to contain the error kind. |
760 class NonConstantValue extends ConstantValue { | 761 class NonConstantValue extends ConstantValue { |
761 bool get isConstant => false; | 762 bool get isConstant => false; |
762 | 763 |
763 @override | 764 @override |
764 accept(ConstantValueVisitor visitor, arg) { | 765 accept(ConstantValueVisitor visitor, arg) { |
765 // TODO(johnniwinther): Should this be part of the visiting? | 766 return visitor.visitNonConstant(this, arg); |
766 } | 767 } |
767 | 768 |
768 @override | 769 @override |
769 List<ConstantValue> getDependencies() => const <ConstantValue>[]; | 770 List<ConstantValue> getDependencies() => const <ConstantValue>[]; |
770 | 771 |
771 @override | 772 @override |
772 DartType getType(CoreTypes types) => const DynamicType(); | 773 DartType getType(CoreTypes types) => const DynamicType(); |
773 | 774 |
774 @override | 775 @override |
775 String toStructuredText() => 'NonConstant'; | 776 String toStructuredText() => 'NonConstant'; |
776 | 777 |
777 @override | 778 @override |
778 String toDartText() => '>>non-constant<<'; | 779 String toDartText() => '>>non-constant<<'; |
779 } | 780 } |
OLD | NEW |