Skip to content

Commit

Permalink
valid code wth a strange bug
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Dec 27, 2023
1 parent d465de0 commit 7f3666d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
4 changes: 1 addition & 3 deletions cmd/src/tools/cmd_fmt.ri
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions cmd/src/tools/cmd_new.ri
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
35 changes: 17 additions & 18 deletions rivetc/src/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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:
Expand Down

0 comments on commit 7f3666d

Please sign in to comment.