@@ -1124,8 +1124,6 @@ void KernelLoader::FinishTopLevelClassLoading(
11241124
11251125void KernelLoader::LoadLibraryImportsAndExports (Library* library,
11261126 const Class& toplevel_class) {
1127- GrowableObjectArray& show_list = GrowableObjectArray::Handle (Z);
1128- GrowableObjectArray& hide_list = GrowableObjectArray::Handle (Z);
11291127 Array& show_names = Array::Handle (Z);
11301128 Array& hide_names = Array::Handle (Z);
11311129 Namespace& ns = Namespace::Handle (Z);
@@ -1153,8 +1151,8 @@ void KernelLoader::LoadLibraryImportsAndExports(Library* library,
11531151 }
11541152
11551153 // Prepare show and hide lists.
1156- show_list = GrowableObjectArray::New (Heap:: kOld );
1157- hide_list = GrowableObjectArray::New (Heap:: kOld );
1154+ GrowableObjectArray& show_list = GrowableObjectArray::Handle (Z );
1155+ GrowableObjectArray& hide_list = GrowableObjectArray::Handle (Z );
11581156 const intptr_t combinator_count = helper_.ReadListLength ();
11591157 for (intptr_t c = 0 ; c < combinator_count; ++c) {
11601158 uint8_t flags = helper_.ReadFlags ();
@@ -1163,20 +1161,26 @@ void KernelLoader::LoadLibraryImportsAndExports(Library* library,
11631161 String& show_hide_name =
11641162 H.DartSymbolObfuscate (helper_.ReadStringReference ());
11651163 if ((flags & LibraryDependencyHelper::Show) != 0 ) {
1164+ if (show_list.IsNull ()) {
1165+ show_list = GrowableObjectArray::New (Heap::kOld );
1166+ }
11661167 show_list.Add (show_hide_name, Heap::kOld );
11671168 } else {
1169+ if (hide_list.IsNull ()) {
1170+ hide_list = GrowableObjectArray::New (Heap::kOld );
1171+ }
11681172 hide_list.Add (show_hide_name, Heap::kOld );
11691173 }
11701174 }
11711175 }
11721176
1173- if (show_list.Length () > 0 ) {
1177+ if (!show_list. IsNull () && show_list.Length () > 0 ) {
11741178 show_names = Array::MakeFixedLength (show_list);
11751179 } else {
11761180 show_names = Array::null ();
11771181 }
11781182
1179- if (hide_list.Length () > 0 ) {
1183+ if (!hide_list. IsNull () && hide_list.Length () > 0 ) {
11801184 hide_names = Array::MakeFixedLength (hide_list);
11811185 } else {
11821186 hide_names = Array::null ();
0 commit comments