Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: pkg/compiler/lib/src/serialization/element_serialization.dart

Issue 1811173003: Support per-library serialization. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.elements; 5 library dart2js.serialization.elements;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../constants/constructors.dart'; 8 import '../constants/constructors.dart';
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 25 matching lines...) Expand all
36 INSTANCE_GETTER, 36 INSTANCE_GETTER,
37 INSTANCE_SETTER, 37 INSTANCE_SETTER,
38 LOCAL_FUNCTION, 38 LOCAL_FUNCTION,
39 TYPEDEF, 39 TYPEDEF,
40 TYPEVARIABLE, 40 TYPEVARIABLE,
41 PARAMETER, 41 PARAMETER,
42 INITIALIZING_FORMAL, 42 INITIALIZING_FORMAL,
43 IMPORT, 43 IMPORT,
44 EXPORT, 44 EXPORT,
45 PREFIX, 45 PREFIX,
46 EXTERNAL_LIBRARY,
47 EXTERNAL_LIBRARY_MEMBER,
48 EXTERNAL_STATIC_MEMBER,
49 EXTERNAL_CONSTRUCTOR,
46 } 50 }
47 51
48 /// Set of serializers used to serialize different kinds of elements by 52 /// Set of serializers used to serialize different kinds of elements by
49 /// encoding into them into [ObjectEncoder]s. 53 /// encoding into them into [ObjectEncoder]s.
50 /// 54 ///
51 /// This class is called from the [Serializer] when an [Element] needs 55 /// This class is called from the [Serializer] when an [Element] needs
52 /// serialization. The [ObjectEncoder] ensures that any [Element], [DartType], 56 /// serialization. The [ObjectEncoder] ensures that any [Element], [DartType],
53 /// and [ConstantExpression] that the serialized [Element] depends upon are also 57 /// and [ConstantExpression] that the serialized [Element] depends upon are also
54 /// serialized. 58 /// serialized.
55 const List<ElementSerializer> ELEMENT_SERIALIZERS = const [ 59 const List<ElementSerializer> ELEMENT_SERIALIZERS = const [
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 /// 590 ///
587 /// This is used by the [Deserializer]. 591 /// This is used by the [Deserializer].
588 class ElementDeserializer { 592 class ElementDeserializer {
589 593
590 /// Deserializes an [Element] from an [ObjectDecoder]. 594 /// Deserializes an [Element] from an [ObjectDecoder].
591 /// 595 ///
592 /// The class is called from the [Deserializer] when an [Element] 596 /// The class is called from the [Deserializer] when an [Element]
593 /// needs deserialization. The [ObjectDecoder] ensures that any [Element], 597 /// needs deserialization. The [ObjectDecoder] ensures that any [Element],
594 /// [DartType], and [ConstantExpression] that the deserialized [Element] 598 /// [DartType], and [ConstantExpression] that the deserialized [Element]
595 /// depends upon are available. 599 /// depends upon are available.
596 static Element deserialize(ObjectDecoder decoder) { 600 static Element deserialize(
597 SerializedElementKind elementKind = 601 ObjectDecoder decoder,
598 decoder.getEnum(Key.KIND, SerializedElementKind.values); 602 SerializedElementKind elementKind) {
599 switch (elementKind) { 603 switch (elementKind) {
600 case SerializedElementKind.LIBRARY: 604 case SerializedElementKind.LIBRARY:
601 return new LibraryElementZ(decoder); 605 return new LibraryElementZ(decoder);
602 case SerializedElementKind.COMPILATION_UNIT: 606 case SerializedElementKind.COMPILATION_UNIT:
603 return new CompilationUnitElementZ(decoder); 607 return new CompilationUnitElementZ(decoder);
604 case SerializedElementKind.CLASS: 608 case SerializedElementKind.CLASS:
605 return new ClassElementZ(decoder); 609 return new ClassElementZ(decoder);
606 case SerializedElementKind.ENUM: 610 case SerializedElementKind.ENUM:
607 return new EnumClassElementZ(decoder); 611 return new EnumClassElementZ(decoder);
608 case SerializedElementKind.NAMED_MIXIN_APPLICATION: 612 case SerializedElementKind.NAMED_MIXIN_APPLICATION:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 case SerializedElementKind.PARAMETER: 648 case SerializedElementKind.PARAMETER:
645 return new ParameterElementZ(decoder); 649 return new ParameterElementZ(decoder);
646 case SerializedElementKind.INITIALIZING_FORMAL: 650 case SerializedElementKind.INITIALIZING_FORMAL:
647 return new InitializingFormalElementZ(decoder); 651 return new InitializingFormalElementZ(decoder);
648 case SerializedElementKind.IMPORT: 652 case SerializedElementKind.IMPORT:
649 return new ImportElementZ(decoder); 653 return new ImportElementZ(decoder);
650 case SerializedElementKind.EXPORT: 654 case SerializedElementKind.EXPORT:
651 return new ExportElementZ(decoder); 655 return new ExportElementZ(decoder);
652 case SerializedElementKind.PREFIX: 656 case SerializedElementKind.PREFIX:
653 return new PrefixElementZ(decoder); 657 return new PrefixElementZ(decoder);
658 case SerializedElementKind.EXTERNAL_LIBRARY:
659 case SerializedElementKind.EXTERNAL_LIBRARY_MEMBER:
660 case SerializedElementKind.EXTERNAL_STATIC_MEMBER:
661 case SerializedElementKind.EXTERNAL_CONSTRUCTOR:
662 break;
654 } 663 }
655 throw new UnsupportedError("Unexpected element kind '${elementKind}."); 664 throw new UnsupportedError("Unexpected element kind '${elementKind}.");
656 } 665 }
657 } 666 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698