Skip to content

Commit 6338547

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

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

vyper/semantics/analysis/imports.py

Lines changed: 3 additions & 11 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,15 +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)
200189

201190
path = _import_to_path(level, module_str)
202191

@@ -206,6 +195,9 @@ def _load_import(
206195

207196
self.graph.imported_modules[path] = node
208197

198+
if _is_builtin(level, module_str):
199+
return _load_builtin_import(level, module_str)
200+
209201
err = None
210202

211203
try:

0 commit comments

Comments
 (0)