Skip to content

Commit

Permalink
keep track of visited
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 8, 2024
1 parent c412402 commit 0716f0a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vyper/semantics/analysis/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def __init__(self, input_bundle: InputBundle, graph: _ImportGraph):
self.graph = graph
self._ast_of: dict[int, vy_ast.Module] = {}

self.seen = set()

self.integrity_sum = None

def resolve_imports(self, module_ast: vy_ast.Module):
Expand All @@ -98,12 +100,15 @@ def _calculate_integrity_sum_r(self, module_ast: vy_ast.Module):
return sha256sum("".join(acc))

def _resolve_imports_r(self, module_ast: vy_ast.Module):
if id(module_ast) in self.seen:
return

Check warning on line 104 in vyper/semantics/analysis/imports.py

View check run for this annotation

Codecov / codecov/patch

vyper/semantics/analysis/imports.py#L104

Added line #L104 was not covered by tests
with self.graph.enter_path(module_ast):
for node in module_ast.body:
if isinstance(node, vy_ast.Import):
self._handle_Import(node)

Check warning on line 108 in vyper/semantics/analysis/imports.py

View check run for this annotation

Codecov / codecov/patch

vyper/semantics/analysis/imports.py#L108

Added line #L108 was not covered by tests
elif isinstance(node, vy_ast.ImportFrom):
self._handle_ImportFrom(node)

Check warning on line 110 in vyper/semantics/analysis/imports.py

View check run for this annotation

Codecov / codecov/patch

vyper/semantics/analysis/imports.py#L110

Added line #L110 was not covered by tests
self.seen.add(id(module_ast))

def _handle_Import(self, node: vy_ast.Import):
# import x.y[name] as y[alias]
Expand Down

0 comments on commit 0716f0a

Please sign in to comment.