| 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 8c940f69fe5586c80a9aab09cc9354c5f8db56a9..c4fc3ef034bf2466d5bdcea7cb9691e34a5e8c91 100644
|
| --- a/pkg/kernel/lib/binary/ast_from_binary.dart
|
| +++ b/pkg/kernel/lib/binary/ast_from_binary.dart
|
| @@ -187,8 +187,7 @@ class BinaryBuilder {
|
| readLibrary();
|
| }
|
| var mainMethod = readMemberReference(allowNull: true);
|
| - return new Program(importTable, uriToSource)
|
| - ..mainMethod = mainMethod;
|
| + return new Program(importTable, uriToSource)..mainMethod = mainMethod;
|
| }
|
|
|
| Map<String, Source> readUriToSource() {
|
| @@ -226,6 +225,11 @@ class BinaryBuilder {
|
| return importTable[index];
|
| }
|
|
|
| + DeferredImport readDeferredImportReference() {
|
| + int index = readUInt();
|
| + return _currentLibrary.deferredImports[index];
|
| + }
|
| +
|
| Class readClassReference({bool allowNull: false}) {
|
| int tag = readByte();
|
| if (tag == Tag.NullReference) {
|
| @@ -292,6 +296,7 @@ class BinaryBuilder {
|
| // TODO(jensj): We currently save (almost the same) uri twice.
|
| _currentLibrary.fileUri = readUriReference();
|
|
|
| + _readDeferredImports(_currentLibrary);
|
| _fillLazilyLoadedList(_currentLibrary.classes, (int tag, int index) {
|
| readClass(loader.getClassReference(_currentLibrary, tag, index), tag);
|
| });
|
| @@ -306,6 +311,19 @@ class BinaryBuilder {
|
| debugPath.removeLast();
|
| }
|
|
|
| + void _readDeferredImports(Library library) {
|
| + int count = readUInt();
|
| + library.deferredImports.length = count;
|
| + for (int i = 0; i < count; ++i) {
|
| + var importNode = _readDeferredImport();
|
| + library.deferredImports.add(importNode..parent = library);
|
| + }
|
| + }
|
| +
|
| + DeferredImport _readDeferredImport() {
|
| + return new DeferredImport(readLibraryReference(), readStringReference());
|
| + }
|
| +
|
| void readClass(Class node, int tag) {
|
| assert(node != null);
|
| switch (tag) {
|
| @@ -530,6 +548,10 @@ class BinaryBuilder {
|
| ? tagByte
|
| : (tagByte & Tag.SpecializedTagMask);
|
| switch (tag) {
|
| + case Tag.LoadLibrary:
|
| + return new LoadLibrary(readDeferredImportReference());
|
| + case Tag.CheckLibraryIsLoaded:
|
| + return new CheckLibraryIsLoaded(readDeferredImportReference());
|
| case Tag.InvalidExpression:
|
| return new InvalidExpression();
|
| case Tag.VariableGet:
|
|
|