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

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

Issue 2852373002: Add import/export declaration AST node boilerplate to kernel. (Closed)
Patch Set: Merge and adapt C++ code to upstream changes Created 3 years, 7 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 db11ce40f4a7c4407325d0faa7505ab603fd04c8..ede560951607e8cd9311168d45637f46d98b2651 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -127,6 +127,10 @@ class BinaryBuilder {
return _stringTable[readUInt()];
}
+ List<String> readStringReferenceList() {
+ return new List<String>.generate(readUInt(), (i) => readStringReference());
+ }
+
String readStringOrNullIfEmpty() {
var string = readStringReference();
return string.isEmpty ? null : string;
@@ -292,9 +296,9 @@ class BinaryBuilder {
return readCanonicalNameReference().getReference();
}
- DeferredImport readDeferredImportReference() {
+ LibraryDependency readLibraryDependencyReference() {
int index = readUInt();
- return _currentLibrary.deferredImports[index];
+ return _currentLibrary.dependencies[index];
}
Reference readClassReference({bool allowNull: false}) {
@@ -350,7 +354,7 @@ class BinaryBuilder {
library.fileUri = fileUri;
}
- _readDeferredImports(library);
+ _readLibraryDependencies(library);
debugPath.add(library.name ?? library.importUri?.toString() ?? 'library');
@@ -364,20 +368,35 @@ class BinaryBuilder {
return library;
}
- void _readDeferredImports(Library library) {
+ void _readLibraryDependencies(Library library) {
int length = readUInt();
if (library.isExternal) {
assert(length == 0);
return;
}
- library.deferredImports.length = length;
+ library.dependencies.length = length;
for (int i = 0; i < length; ++i) {
- library.deferredImports[i] = new DeferredImport.byReference(
- readLibraryReference(), readStringReference())
+ var flags = readByte();
+ var annotations = readExpressionList();
+ var targetLibrary = readLibraryReference();
+ var prefixName = readStringOrNullIfEmpty();
+ var names = readCombinatorList();
+ library.dependencies[i] = new LibraryDependency.byReference(
+ flags, annotations, targetLibrary, prefixName, names)
..parent = library;
}
}
+ Combinator readCombinator() {
+ var isShow = readUInt() == 1;
+ var names = readStringReferenceList();
+ return new Combinator(isShow, names);
+ }
+
+ List<Combinator> readCombinatorList() {
+ return new List<Combinator>.generate(readUInt(), (i) => readCombinator());
+ }
+
Typedef readTypedef() {
var canonicalName = readCanonicalNameReference();
var reference = canonicalName.getReference();
@@ -658,9 +677,9 @@ class BinaryBuilder {
: (tagByte & Tag.SpecializedTagMask);
switch (tag) {
case Tag.LoadLibrary:
- return new LoadLibrary(readDeferredImportReference());
+ return new LoadLibrary(readLibraryDependencyReference());
case Tag.CheckLibraryIsLoaded:
- return new CheckLibraryIsLoaded(readDeferredImportReference());
+ return new CheckLibraryIsLoaded(readLibraryDependencyReference());
case Tag.InvalidExpression:
return new InvalidExpression();
case Tag.VariableGet:
« 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