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

Unified Diff: pkg/kernel/lib/binary/ast_from_binary.dart

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 | « pkg/kernel/lib/ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/binary/ast_from_binary.dart
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index 9cbc69d92e7c66b9b81334939efdb0e230740717..86503ffa388ef04947663d934bce031e921808d2 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -313,6 +313,10 @@ class BinaryBuilder {
return name?.getReference();
}
+ Reference readTypedefReference() {
+ return readCanonicalNameReference().getReference();
+ }
+
Name readName() {
String text = readStringReference();
if (text.isNotEmpty && text[0] == '_') {
@@ -350,6 +354,7 @@ class BinaryBuilder {
debugPath.add(library.name ?? library.importUri?.toString() ?? 'library');
+ _mergeNamedNodeList(library.typedefs, readTypedef, library);
_mergeNamedNodeList(library.classes, readClass, library);
_mergeNamedNodeList(library.fields, readField, library);
_mergeNamedNodeList(library.procedures, readProcedure, library);
@@ -373,6 +378,29 @@ class BinaryBuilder {
}
}
+ Typedef readTypedef() {
+ var canonicalName = readCanonicalNameReference();
+ var reference = canonicalName.getReference();
+ Typedef node = reference.node;
+ bool shouldWriteData = node == null || _isReadingLibraryImplementation;
+ if (node == null) {
+ node = new Typedef(null, null, reference: reference);
+ }
+ int fileOffset = readOffset();
+ String name = readStringReference();
+ String fileUri = readUriReference();
+ readAndPushTypeParameterList(node.typeParameters, node);
+ var type = readDartType();
+ typeParameterStack.length = 0;
+ if (shouldWriteData) {
+ node.fileOffset = fileOffset;
+ node.name = name;
+ node.fileUri = fileUri;
+ node.type = type;
+ }
+ return node;
+ }
+
Class readClass() {
int tag = readByte();
assert(tag == Tag.Class);
@@ -1019,6 +1047,9 @@ class BinaryBuilder {
DartType readDartType() {
int tag = readByte();
switch (tag) {
+ case Tag.TypedefType:
+ return new TypedefType.byReference(
+ readTypedefReference(), readDartTypeList());
case Tag.VectorType:
return const VectorType();
case Tag.BottomType:
« no previous file with comments | « pkg/kernel/lib/ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698