File tree 1 file changed +20
-11
lines changed
1 file changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,23 @@ static RawInstance* CreateClassMirror(const Class& cls,
331
331
return CreateMirror (Symbols::_LocalClassMirror (), args);
332
332
}
333
333
334
+ static bool IsCensoredLibrary (const String& url) {
335
+ static const char * const censored_libraries[] = {
336
+ " dart:_builtin" ,
337
+ " dart:_vmservice" ,
338
+ " dart:vmservice_io" ,
339
+ };
340
+ for (const char * censored_library : censored_libraries) {
341
+ if (url.Equals (censored_library)) {
342
+ return true ;
343
+ }
344
+ }
345
+ if (!Api::IsFfiEnabled () && url.Equals (Symbols::DartFfi ())) {
346
+ return true ;
347
+ }
348
+ return false ;
349
+ }
350
+
334
351
static RawInstance* CreateLibraryMirror (Thread* thread, const Library& lib) {
335
352
Zone* zone = thread->zone ();
336
353
ASSERT (!lib.IsNull ());
@@ -340,17 +357,9 @@ static RawInstance* CreateLibraryMirror(Thread* thread, const Library& lib) {
340
357
str = lib.name ();
341
358
args.SetAt (1 , str);
342
359
str = lib.url ();
343
- const char * censored_libraries[] = {
344
- " dart:_builtin" ,
345
- " dart:_vmservice" ,
346
- " dart:vmservice_io" ,
347
- NULL ,
348
- };
349
- for (intptr_t i = 0 ; censored_libraries[i] != NULL ; i++) {
350
- if (str.Equals (censored_libraries[i])) {
351
- // Censored library (grumble).
352
- return Instance::null ();
353
- }
360
+ if (IsCensoredLibrary (str)) {
361
+ // Censored library (grumble).
362
+ return Instance::null ();
354
363
}
355
364
args.SetAt (2 , str);
356
365
return CreateMirror (Symbols::_LocalLibraryMirror (), args);
You can’t perform that action at this time.
0 commit comments