diff --git a/cmd/src/tools/cmd_fmt.ri b/cmd/src/tools/cmd_fmt.ri index 72918b2d4..00dd09a3a 100644 --- a/cmd/src/tools/cmd_fmt.ri +++ b/cmd/src/tools/cmd_fmt.ri @@ -2,9 +2,7 @@ // source code is governed by an MIT license that can be found in the LICENSE // file. -import std/{ flag, console }; -import std/fs.Directory; - +import std/{ flag, console, fs.Directory }; import rivet/{ ast, fmt, prefs, utils, parser }; var fmt_desc := "Formats the given Rivet source files or recursively formats all files in the diff --git a/cmd/src/tools/cmd_new.ri b/cmd/src/tools/cmd_new.ri index 19454f133..43c7219c8 100644 --- a/cmd/src/tools/cmd_new.ri +++ b/cmd/src/tools/cmd_new.ri @@ -3,9 +3,8 @@ // file. import std/{ - flag, semver, strings, console, process, fs.{ Path, Directory, self } + flag, semver, strings, console, process, fs.{ self, Path, Directory } }; - import rivet/{ build, utils }; import ./templates; diff --git a/rivetc/src/register.py b/rivetc/src/register.py index 117178341..5935e1e15 100644 --- a/rivetc/src/register.py +++ b/rivetc/src/register.py @@ -205,8 +205,7 @@ def walk_import_decl(self, decl): if len(decl.subimports) > 0: for subimport in decl.subimports: self.walk_import_decl(subimport) - return - if len(decl.import_list) == 0: + elif len(decl.import_list) == 0: if decl.is_public: try: self.sym.add( @@ -219,27 +218,27 @@ def walk_import_decl(self, decl): else: self.source_file.imported_symbols[decl.alias ] = decl.mod_sym - if decl.glob: + elif decl.glob: for symbol in decl.mod_sym.syms: if not symbol.is_public: continue self.check_imported_symbol(symbol, decl.pos) self.source_file.imported_symbols[symbol.name] = symbol - return - for import_info in decl.import_list: - if import_info.name == "self": - self.source_file.imported_symbols[decl.alias - ] = decl.mod_sym - elif symbol := decl.mod_sym.find(import_info.name): - self.check_vis(symbol, import_info.pos) - self.check_imported_symbol(symbol, import_info.pos) - self.source_file.imported_symbols[import_info.alias - ] = symbol - else: - report.error( - f"could not find `{import_info.name}` in module `{decl.mod_sym.name}`", - import_info.pos - ) + else: + for import_info in decl.import_list: + if import_info.name == "self": + self.source_file.imported_symbols[decl.alias + ] = decl.mod_sym + elif symbol := decl.mod_sym.find(import_info.name): + self.check_vis(symbol, import_info.pos) + self.check_imported_symbol(symbol, import_info.pos) + self.source_file.imported_symbols[import_info.alias + ] = symbol + else: + report.error( + f"could not find `{import_info.name}` in module `{decl.mod_sym.name}`", + import_info.pos + ) def add_sym(self, sy, pos): try: