Index: runtime/vm/kernel_binary.cc |
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc |
index e0a81d73ffbf3e43638ffcab268b012213e92933..d38dd8b0563f954f1dbb116d852022f294b82acc 100644 |
--- a/runtime/vm/kernel_binary.cc |
+++ b/runtime/vm/kernel_binary.cc |
@@ -215,6 +215,11 @@ Library* Library::ReadFrom(Reader* reader) { |
if (num_imports != 0) { |
FATAL("Deferred imports not implemented in VM"); |
} |
+ int num_typedefs = reader->ReadUInt(); |
+ typedefs().EnsureInitialized(num_typedefs); |
+ for (intptr_t i = 0; i < num_typedefs; i++) { |
+ typedefs().GetOrCreate<Typedef>(i, this)->ReadFrom(reader); |
+ } |
int num_classes = reader->ReadUInt(); |
classes().EnsureInitialized(num_classes); |
for (intptr_t i = 0; i < num_classes; i++) { |
@@ -230,6 +235,20 @@ Library* Library::ReadFrom(Reader* reader) { |
} |
+Typedef* Typedef::ReadFrom(Reader* reader) { |
+ TRACE_READ_OFFSET(); |
+ |
+ canonical_name_ = reader->ReadCanonicalNameReference(); |
+ position_ = reader->ReadPosition(false); |
+ name_ = Reference::ReadStringFrom(reader); |
+ source_uri_index_ = reader->ReadUInt(); |
+ type_parameters_.ReadFrom(reader); |
+ type_ = DartType::ReadFrom(reader); |
+ |
+ return this; |
+} |
+ |
+ |
Class* Class::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
@@ -313,6 +332,20 @@ CanonicalName* Reference::ReadClassFrom(Reader* reader, bool allow_null) { |
} |
+CanonicalName* Reference::ReadTypedefFrom(Reader* reader) { |
+ TRACE_READ_OFFSET(); |
+ |
+ CanonicalName* canonical_name = reader->ReadCanonicalNameReference(); |
+ if (canonical_name == NULL) { |
+ FATAL("Expected a valid typedef reference, but got `null`"); |
+ } |
+ |
+ canonical_name->set_referenced(true); |
+ |
+ return canonical_name; |
+} |
+ |
+ |
String* Reference::ReadStringFrom(Reader* reader) { |
int index = reader->ReadUInt(); |
return reader->helper()->program()->string_table().strings()[index]; |
@@ -1411,6 +1444,8 @@ DartType* DartType::ReadFrom(Reader* reader) { |
return TypeParameterType::ReadFrom(reader); |
case kVectorType: |
return VectorType::ReadFrom(reader); |
+ case kTypedefType: |
+ return TypedefType::ReadFrom(reader); |
default: |
UNREACHABLE(); |
} |
@@ -1456,6 +1491,15 @@ InterfaceType* InterfaceType::ReadFrom(Reader* reader, |
} |
+TypedefType* TypedefType::ReadFrom(Reader* reader) { |
+ TRACE_READ_OFFSET(); |
+ CanonicalName* typedef_name = Reference::ReadTypedefFrom(reader); |
+ TypedefType* type = new TypedefType(typedef_name); |
+ type->type_arguments().ReadFromStatic<DartType>(reader); |
+ return type; |
+} |
+ |
+ |
FunctionType* FunctionType::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
FunctionType* type = new FunctionType(); |