OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.serialization.constants; | 5 library dart2js.serialization.constants; |
6 | 6 |
7 import '../constants/constructors.dart'; | 7 import '../constants/constructors.dart'; |
8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../elements/elements.dart' show FieldElement; | 10 import '../elements/elements.dart' show FieldElement; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 @override | 164 @override |
165 void visitStringLength( | 165 void visitStringLength( |
166 StringLengthConstantExpression exp, ObjectEncoder encoder) { | 166 StringLengthConstantExpression exp, ObjectEncoder encoder) { |
167 encoder.setConstant(Key.EXPRESSION, exp.expression); | 167 encoder.setConstant(Key.EXPRESSION, exp.expression); |
168 } | 168 } |
169 | 169 |
170 @override | 170 @override |
171 void visitDeferred(DeferredConstantExpression exp, ObjectEncoder encoder) { | 171 void visitDeferred(DeferredConstantExpression exp, ObjectEncoder encoder) { |
172 throw new UnsupportedError( | 172 throw new UnsupportedError( |
173 "ConstantSerializer.visitDeferred: ${exp.getText()}"); | 173 "ConstantSerializer.visitDeferred: ${exp.toDartText()}"); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 /// Utility class for deserializing [ConstantExpression]s. | 177 /// Utility class for deserializing [ConstantExpression]s. |
178 /// | 178 /// |
179 /// This is used by the [Deserializer]. | 179 /// This is used by the [Deserializer]. |
180 class ConstantDeserializer { | 180 class ConstantDeserializer { |
181 /// Deserializes a [ConstantExpression] from an [ObjectDecoder]. | 181 /// Deserializes a [ConstantExpression] from an [ObjectDecoder]. |
182 /// | 182 /// |
183 /// The class is called from the [Deserializer] when a [ConstantExpression] | 183 /// The class is called from the [Deserializer] when a [ConstantExpression] |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 readFields(), readConstructorInvocation()); | 390 readFields(), readConstructorInvocation()); |
391 case ConstantConstructorKind.REDIRECTING_GENERATIVE: | 391 case ConstantConstructorKind.REDIRECTING_GENERATIVE: |
392 return new RedirectingGenerativeConstantConstructor( | 392 return new RedirectingGenerativeConstantConstructor( |
393 readDefaults(), readConstructorInvocation()); | 393 readDefaults(), readConstructorInvocation()); |
394 case ConstantConstructorKind.REDIRECTING_FACTORY: | 394 case ConstantConstructorKind.REDIRECTING_FACTORY: |
395 return new RedirectingFactoryConstantConstructor( | 395 return new RedirectingFactoryConstantConstructor( |
396 readConstructorInvocation()); | 396 readConstructorInvocation()); |
397 } | 397 } |
398 } | 398 } |
399 } | 399 } |
OLD | NEW |