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

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

Issue 2099703002: Support malformed types (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
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 3d4cb9fd353d5ac8cd582d36a9b0032fb4d98743..24a46ae27f84757df04aac019727a6bd9b99f8e5 100644
--- a/pkg/compiler/lib/src/serialization/type_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/type_serialization.dart
@@ -35,7 +35,9 @@ class TypeSerializer extends DartTypeVisitor<dynamic, ObjectEncoder> {
encoder.setTypes(Key.NAMED_PARAMETER_TYPES, type.namedParameterTypes);
}
- void visitMalformedType(MalformedType type, ObjectEncoder encoder) {}
+ void visitMalformedType(MalformedType type, ObjectEncoder encoder) {
+ encoder.setElement(Key.ELEMENT, type.element);
+ }
void visitInterfaceType(InterfaceType type, ObjectEncoder encoder) {
encoder.setElement(Key.ELEMENT, type.element);
@@ -79,8 +81,11 @@ class TypeDeserializer {
return new TypedefType(decoder.getElement(Key.ELEMENT),
decoder.getTypes(Key.TYPE_ARGUMENTS, isOptional: true));
case TypeKind.STATEMENT:
- case TypeKind.MALFORMED_TYPE:
throw new UnsupportedError("Unexpected type kind '${typeKind}.");
+ case TypeKind.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:
« no previous file with comments | « pkg/compiler/lib/src/serialization/element_serialization.dart ('k') | tests/compiler/dart2js/serialization/test_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698