@@ -54,6 +54,8 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
5454 Set <CanonicalName > _knownCanonicalNameNonRootTops = new Set <CanonicalName >();
5555 Set <CanonicalName > _reindexedCanonicalNames = new Set <CanonicalName >();
5656
57+ Library _currentLibrary;
58+
5759 /// Create a printer that writes to the given [sink] .
5860 ///
5961 /// The BinaryPrinter will use its own buffer, so the [sink] does not need
@@ -930,6 +932,8 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
930932
931933 @override
932934 void visitLibrary (Library node) {
935+ _currentLibrary = node;
936+
933937 // ignore: DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE
934938 insideExternalLibrary = node.isExternal;
935939 libraryOffsets.add (getBufferOffset ());
@@ -992,6 +996,8 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
992996 writeUInt32 (offset);
993997 }
994998 writeUInt32 (procedureOffsets.length - 1 );
999+
1000+ _currentLibrary = null ;
9951001 }
9961002
9971003 void writeLibraryDependencies (Library library) {
@@ -2068,11 +2074,11 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
20682074 // requires the nullability byte.
20692075 if (node.typeArguments.isEmpty) {
20702076 writeByte (Tag .SimpleInterfaceType );
2071- writeByte (Nullability .nonNullable.index);
2077+ writeByte (_currentLibrary .nonNullable.index);
20722078 writeNonNullReference (node.className);
20732079 } else {
20742080 writeByte (Tag .InterfaceType );
2075- writeByte (Nullability .nonNullable.index);
2081+ writeByte (_currentLibrary .nonNullable.index);
20762082 writeNonNullReference (node.className);
20772083 writeNodeList (node.typeArguments);
20782084 }
0 commit comments