Skip to content

Commit 46be18d

Browse files
committed
Use self.graph for more reliability
1 parent 2011051 commit 46be18d

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

vyper/semantics/analysis/imports.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,10 @@ class ImportAnalyzer:
8888
seen: OrderedSet[vy_ast.Module]
8989
_compiler_inputs: dict[CompilerInput, vy_ast.Module]
9090
toplevel_module: vy_ast.Module
91-
importedBuiltins: dict[str, vy_ast.VyperNode]
9291

9392
def __init__(self, input_bundle: InputBundle, graph: _ImportGraph, module_ast: vy_ast.Module):
9493
self.input_bundle = input_bundle
9594
self.graph = graph
96-
self.importedBuiltins = {}
9795
self.toplevel_module = module_ast
9896
self._ast_of: dict[int, vy_ast.Module] = {}
9997

@@ -188,16 +186,6 @@ def _add_import(
188186
def _load_import(
189187
self, node: vy_ast.VyperNode, level: int, module_str: str, alias: str
190188
) -> tuple[CompilerInput, Any]:
191-
if _is_builtin(level, module_str):
192-
if module_str in self.importedBuiltins:
193-
previous_import_stmt = self.importedBuiltins[module_str]
194-
raise DuplicateImport(
195-
f"{module_str} imported more than once!", previous_import_stmt, node
196-
)
197-
198-
self.importedBuiltins[module_str] = node
199-
return _load_builtin_import(level, module_str)
200-
201189
path = _import_to_path(level, module_str)
202190

203191
if path in self.graph.imported_modules:
@@ -206,6 +194,9 @@ def _load_import(
206194

207195
self.graph.imported_modules[path] = node
208196

197+
if _is_builtin(level, module_str):
198+
return _load_builtin_import(level, module_str)
199+
209200
err = None
210201

211202
try:

0 commit comments

Comments
 (0)