Skip to content

Commit

Permalink
clean up recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Dec 13, 2024
1 parent c91f13e commit a140226
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions vyper/semantics/analysis/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,14 @@ def _load_import(

def _load_file(self, path: PathLike, level: int) -> CompilerInput:
ast = self.graph.current_module
current_search_path = Path(ast.resolved_path).parent

search_paths = self.absolute_search_paths if level == 0 else [current_search_path]
if level != 0: # relative import
search_paths = [Path(ast.resolved_path).parent]
else:
search_paths = self.absolute_search_paths

with self.input_bundle.temporary_search_paths(search_paths):
res = self.input_bundle.load_file(path)

if level != 0:
self.input_bundle.search_paths.append(current_search_path)

return res
return self.input_bundle.load_file(path)

def _ast_from_file(self, file: FileInput) -> vy_ast.Module:
# cache ast if we have seen it before.
Expand Down

0 comments on commit a140226

Please sign in to comment.