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

Unified Diff: runtime/vm/kernel_binary.cc

Issue 2825053002: Add typedef AST node boilerplate. (Closed)
Patch Set: Update FastaVerifyingVisitor to work with the changes in VerifyingVisitor Created 3 years, 8 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 | « runtime/vm/kernel_binary.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « runtime/vm/kernel_binary.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698