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 '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
10 import '../elements/elements.dart' | 10 import '../elements/elements.dart' |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 /// Utility class for deserializing [ConstantConstructor]s. | 359 /// Utility class for deserializing [ConstantConstructor]s. |
360 /// | 360 /// |
361 /// This is used by the [ConstructorElementZ]. | 361 /// This is used by the [ConstructorElementZ]. |
362 class ConstantConstructorDeserializer { | 362 class ConstantConstructorDeserializer { |
363 /// Deserializes a [ConstantConstructor] from an [ObjectDecoder]. | 363 /// Deserializes a [ConstantConstructor] from an [ObjectDecoder]. |
364 /// | 364 /// |
365 /// The class is called from the [Deserializer] when a constant constructor | 365 /// The class is called from the [Deserializer] when a constant constructor |
366 /// needs deserialization. The [ObjectDecoder] ensures that any [Element], | 366 /// needs deserialization. The [ObjectDecoder] ensures that any [Element], |
367 /// [ResolutionDartType], and [ConstantExpression] that the deserialized | 367 /// [ResolutionDartType], and [ConstantExpression] that the deserialized |
368 /// [ConstantConstructor] depends upon are available. | 368 /// [ConstantConstructor] depends upon are available. |
| 369 // ignore: MISSING_RETURN |
369 static ConstantConstructor deserialize(ObjectDecoder decoder) { | 370 static ConstantConstructor deserialize(ObjectDecoder decoder) { |
370 ConstantConstructorKind kind = | 371 ConstantConstructorKind kind = |
371 decoder.getEnum(Key.KIND, ConstantConstructorKind.values); | 372 decoder.getEnum(Key.KIND, ConstantConstructorKind.values); |
372 | 373 |
373 ResolutionDartType readType() { | 374 ResolutionDartType readType() { |
374 return decoder.getType(Key.TYPE); | 375 return decoder.getType(Key.TYPE); |
375 } | 376 } |
376 | 377 |
377 Map<dynamic /*int|String*/, ConstantExpression> readDefaults() { | 378 Map<dynamic /*int|String*/, ConstantExpression> readDefaults() { |
378 Map<dynamic, ConstantExpression> defaultValues = | 379 Map<dynamic, ConstantExpression> defaultValues = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 type, readDefaults(), readFields(), readConstructorInvocation()); | 418 type, readDefaults(), readFields(), readConstructorInvocation()); |
418 case ConstantConstructorKind.REDIRECTING_GENERATIVE: | 419 case ConstantConstructorKind.REDIRECTING_GENERATIVE: |
419 return new RedirectingGenerativeConstantConstructor( | 420 return new RedirectingGenerativeConstantConstructor( |
420 readDefaults(), readConstructorInvocation()); | 421 readDefaults(), readConstructorInvocation()); |
421 case ConstantConstructorKind.REDIRECTING_FACTORY: | 422 case ConstantConstructorKind.REDIRECTING_FACTORY: |
422 return new RedirectingFactoryConstantConstructor( | 423 return new RedirectingFactoryConstantConstructor( |
423 readConstructorInvocation()); | 424 readConstructorInvocation()); |
424 } | 425 } |
425 } | 426 } |
426 } | 427 } |
OLD | NEW |