private void importStar(@NotNull Scope s, @Nullable ModuleType mt) { if (mt == null || mt.getFile() == null) { return; } Module mod = Indexer.idx.getAstForFile(mt.getFile()); if (mod == null) { return; } List<String> names = new ArrayList<>(); Type allType = mt.getTable().lookupType("__all__"); if (allType != null && allType.isListType()) { ListType lt = allType.asListType(); for (Object o : lt.values) { if (o instanceof String) { names.add((String) o); } } } if (!names.isEmpty()) { for (String name : names) { List<Binding> b = mt.getTable().lookupLocal(name); if (b != null) { s.update(name, b); } else { List<Name> m2 = new ArrayList<>(module); m2.add(new Name(name)); ModuleType mod2 = Indexer.idx.loadModule(m2, s); if (mod2 != null) { s.insert(name, null, mod2, Binding.Kind.VARIABLE); } } } } else { // Fall back to importing all names not starting with "_". for (Entry<String, List<Binding>> e : mt.getTable().entrySet()) { if (!e.getKey().startsWith("_")) { s.update(e.getKey(), e.getValue()); } } } }