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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 DartString toDartString(); | 152 DartString toDartString(); |
153 | 153 |
154 /// This value in Dart syntax. | 154 /// This value in Dart syntax. |
155 String toDartText() => primitiveValue.toString(); | 155 String toDartText() => primitiveValue.toString(); |
156 } | 156 } |
157 | 157 |
158 class NullConstantValue extends PrimitiveConstantValue { | 158 class NullConstantValue extends PrimitiveConstantValue { |
159 /** The value a Dart null is compiled to in JavaScript. */ | 159 /** The value a Dart null is compiled to in JavaScript. */ |
160 static const String JsNull = "null"; | 160 static const String JsNull = "null"; |
161 | 161 |
162 factory NullConstantValue() => const NullConstantValue._internal(); | 162 const factory NullConstantValue() = NullConstantValue._internal; |
Siggi Cherem (dart-lang)
2016/04/29 20:26:40
I didn't know we were allowed to declare a factory
Johnni Winther
2016/04/30 09:06:02
When they are redirecting we can (I changed that t
| |
163 | 163 |
164 const NullConstantValue._internal(); | 164 const NullConstantValue._internal(); |
165 | 165 |
166 bool get isNull => true; | 166 bool get isNull => true; |
167 | 167 |
168 get primitiveValue => null; | 168 get primitiveValue => null; |
169 | 169 |
170 DartType getType(CoreTypes types) => types.nullType; | 170 DartType getType(CoreTypes types) => types.nullType; |
171 | 171 |
172 // The magic constant has no meaning. It is just a random value. | 172 // The magic constant has no meaning. It is just a random value. |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
770 | 770 |
771 @override | 771 @override |
772 DartType getType(CoreTypes types) => const DynamicType(); | 772 DartType getType(CoreTypes types) => const DynamicType(); |
773 | 773 |
774 @override | 774 @override |
775 String toStructuredText() => 'NonConstant'; | 775 String toStructuredText() => 'NonConstant'; |
776 | 776 |
777 @override | 777 @override |
778 String toDartText() => '>>non-constant<<'; | 778 String toDartText() => '>>non-constant<<'; |
779 } | 779 } |
OLD | NEW |