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

Unified Diff: pkg/compiler/lib/src/serialization/type_serialization.dart

Issue 2603263002: Prefix resolution_types with Resolution. (Closed)
Patch Set: Rebased Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/serialization/system.dart ('k') | pkg/compiler/lib/src/serialization/values.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/serialization/type_serialization.dart
diff --git a/pkg/compiler/lib/src/serialization/type_serialization.dart b/pkg/compiler/lib/src/serialization/type_serialization.dart
index 30372dceb553e091fae01487e19411068a4c946a..c5f68c848f3fdf76fde99bba3fb3c6e9929190fc 100644
--- a/pkg/compiler/lib/src/serialization/type_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/type_serialization.dart
@@ -9,27 +9,30 @@ import '../elements/elements.dart';
import 'keys.dart';
import 'serialization.dart';
-/// Visitor that serializes a [DartType] by encoding it into an [ObjectEncoder].
+/// Visitor that serializes a [ResolutionDartType] by encoding it into an
+/// [ObjectEncoder].
///
-/// This class is called from the [Serializer] when a [DartType] needs
+/// This class is called from the [Serializer] when a [ResolutionDartType] needs
/// serialization. The [ObjectEncoder] ensures that any [Element], and other
-/// [DartType] that the serialized [DartType] depends upon are also serialized.
+/// [ResolutionDartType] that the serialized [ResolutionDartType] depends upon
+/// are also serialized.
class TypeSerializer extends DartTypeVisitor<dynamic, ObjectEncoder> {
const TypeSerializer();
- void visitType(DartType type, ObjectEncoder encoder) {
+ void visitType(ResolutionDartType type, ObjectEncoder encoder) {
throw new UnsupportedError('Unsupported type: $type');
}
- void visitVoidType(VoidType type, ObjectEncoder encoder) {}
+ void visitVoidType(ResolutionVoidType type, ObjectEncoder encoder) {}
- void visitTypeVariableType(TypeVariableType type, ObjectEncoder encoder) {
+ void visitTypeVariableType(
+ ResolutionTypeVariableType type, ObjectEncoder encoder) {
encoder.setElement(Key.ELEMENT, type.element);
encoder.setBool(
Key.IS_METHOD_TYPE_VARIABLE_TYPE, type is MethodTypeVariableType);
}
- void visitFunctionType(FunctionType type, ObjectEncoder encoder) {
+ void visitFunctionType(ResolutionFunctionType type, ObjectEncoder encoder) {
// TODO(johnniwinther): Support encoding of `type.element`.
encoder.setType(Key.RETURN_TYPE, type.returnType);
encoder.setTypes(Key.PARAMETER_TYPES, type.parameterTypes);
@@ -42,59 +45,61 @@ class TypeSerializer extends DartTypeVisitor<dynamic, ObjectEncoder> {
encoder.setElement(Key.ELEMENT, type.element);
}
- void visitInterfaceType(InterfaceType type, ObjectEncoder encoder) {
+ void visitInterfaceType(ResolutionInterfaceType type, ObjectEncoder encoder) {
encoder.setElement(Key.ELEMENT, type.element);
encoder.setTypes(Key.TYPE_ARGUMENTS, type.typeArguments);
}
- void visitTypedefType(TypedefType type, ObjectEncoder encoder) {
+ void visitTypedefType(ResolutionTypedefType type, ObjectEncoder encoder) {
encoder.setElement(Key.ELEMENT, type.element);
encoder.setTypes(Key.TYPE_ARGUMENTS, type.typeArguments);
}
- void visitDynamicType(DynamicType type, ObjectEncoder encoder) {}
+ void visitDynamicType(ResolutionDynamicType type, ObjectEncoder encoder) {}
}
-/// Utility class for deserializing [DartType]s.
+/// Utility class for deserializing [ResolutionDartType]s.
///
/// This is used by the [Deserializer].
class TypeDeserializer {
- /// Deserializes a [DartType] from an [ObjectDecoder].
+ /// Deserializes a [ResolutionDartType] from an [ObjectDecoder].
///
- /// The class is called from the [Deserializer] when a [DartType] needs
- /// deserialization. The [ObjectDecoder] ensures that any [Element], other
- /// [DartType] that the deserialized [DartType] depends upon are available.
- static DartType deserialize(ObjectDecoder decoder) {
- TypeKind typeKind = decoder.getEnum(Key.KIND, TypeKind.values);
+ /// The class is called from the [Deserializer] when a [ResolutionDartType]
+ /// needs deserialization. The [ObjectDecoder] ensures that any [Element],
+ /// other [ResolutionDartType] that the deserialized [ResolutionDartType]
+ /// depends upon are available.
+ static ResolutionDartType deserialize(ObjectDecoder decoder) {
+ ResolutionTypeKind typeKind =
+ decoder.getEnum(Key.KIND, ResolutionTypeKind.values);
switch (typeKind) {
- case TypeKind.INTERFACE:
- return new InterfaceType(decoder.getElement(Key.ELEMENT),
+ case ResolutionTypeKind.INTERFACE:
+ return new ResolutionInterfaceType(decoder.getElement(Key.ELEMENT),
decoder.getTypes(Key.TYPE_ARGUMENTS, isOptional: true));
- case TypeKind.FUNCTION:
+ case ResolutionTypeKind.FUNCTION:
// TODO(johnniwinther): Support decoding of `type.element`.
- return new FunctionType.synthesized(
+ return new ResolutionFunctionType.synthesized(
decoder.getType(Key.RETURN_TYPE),
decoder.getTypes(Key.PARAMETER_TYPES, isOptional: true),
decoder.getTypes(Key.OPTIONAL_PARAMETER_TYPES, isOptional: true),
decoder.getStrings(Key.NAMED_PARAMETERS, isOptional: true),
decoder.getTypes(Key.NAMED_PARAMETER_TYPES, isOptional: true));
- case TypeKind.TYPE_VARIABLE:
+ case ResolutionTypeKind.TYPE_VARIABLE:
TypeVariableElement element = decoder.getElement(Key.ELEMENT);
if (decoder.getBool(Key.IS_METHOD_TYPE_VARIABLE_TYPE)) {
return new MethodTypeVariableType(element);
}
- return new TypeVariableType(element);
- case TypeKind.TYPEDEF:
- return new TypedefType(decoder.getElement(Key.ELEMENT),
+ return new ResolutionTypeVariableType(element);
+ case ResolutionTypeKind.TYPEDEF:
+ return new ResolutionTypedefType(decoder.getElement(Key.ELEMENT),
decoder.getTypes(Key.TYPE_ARGUMENTS, isOptional: true));
- case TypeKind.MALFORMED_TYPE:
+ case ResolutionTypeKind.MALFORMED_TYPE:
// TODO(johnniwinther): Do we need the 'userProvidedBadType' or maybe
// just a toString of it?
return new MalformedType(decoder.getElement(Key.ELEMENT), null);
- case TypeKind.DYNAMIC:
- return const DynamicType();
- case TypeKind.VOID:
- return const VoidType();
+ case ResolutionTypeKind.DYNAMIC:
+ return const ResolutionDynamicType();
+ case ResolutionTypeKind.VOID:
+ return const ResolutionVoidType();
}
}
}
« no previous file with comments | « pkg/compiler/lib/src/serialization/system.dart ('k') | pkg/compiler/lib/src/serialization/values.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698