@@ -1124,8 +1124,6 @@ void KernelLoader::FinishTopLevelClassLoading(
1124
1124
1125
1125
void KernelLoader::LoadLibraryImportsAndExports (Library* library,
1126
1126
const Class& toplevel_class) {
1127
- GrowableObjectArray& show_list = GrowableObjectArray::Handle (Z);
1128
- GrowableObjectArray& hide_list = GrowableObjectArray::Handle (Z);
1129
1127
Array& show_names = Array::Handle (Z);
1130
1128
Array& hide_names = Array::Handle (Z);
1131
1129
Namespace& ns = Namespace::Handle (Z);
@@ -1153,8 +1151,8 @@ void KernelLoader::LoadLibraryImportsAndExports(Library* library,
1153
1151
}
1154
1152
1155
1153
// 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 );
1158
1156
const intptr_t combinator_count = helper_.ReadListLength ();
1159
1157
for (intptr_t c = 0 ; c < combinator_count; ++c) {
1160
1158
uint8_t flags = helper_.ReadFlags ();
@@ -1163,20 +1161,26 @@ void KernelLoader::LoadLibraryImportsAndExports(Library* library,
1163
1161
String& show_hide_name =
1164
1162
H.DartSymbolObfuscate (helper_.ReadStringReference ());
1165
1163
if ((flags & LibraryDependencyHelper::Show) != 0 ) {
1164
+ if (show_list.IsNull ()) {
1165
+ show_list = GrowableObjectArray::New (Heap::kOld );
1166
+ }
1166
1167
show_list.Add (show_hide_name, Heap::kOld );
1167
1168
} else {
1169
+ if (hide_list.IsNull ()) {
1170
+ hide_list = GrowableObjectArray::New (Heap::kOld );
1171
+ }
1168
1172
hide_list.Add (show_hide_name, Heap::kOld );
1169
1173
}
1170
1174
}
1171
1175
}
1172
1176
1173
- if (show_list.Length () > 0 ) {
1177
+ if (!show_list. IsNull () && show_list.Length () > 0 ) {
1174
1178
show_names = Array::MakeFixedLength (show_list);
1175
1179
} else {
1176
1180
show_names = Array::null ();
1177
1181
}
1178
1182
1179
- if (hide_list.Length () > 0 ) {
1183
+ if (!hide_list. IsNull () && hide_list.Length () > 0 ) {
1180
1184
hide_names = Array::MakeFixedLength (hide_list);
1181
1185
} else {
1182
1186
hide_names = Array::null ();
0 commit comments