diff --git a/vyper/semantics/analysis/imports.py b/vyper/semantics/analysis/imports.py index 833e616182..3cf7a9ba94 100644 --- a/vyper/semantics/analysis/imports.py +++ b/vyper/semantics/analysis/imports.py @@ -107,10 +107,11 @@ def _resolve_imports_r(self, module_ast: vy_ast.Module): return with self.graph.enter_path(module_ast): for node in module_ast.body: - if isinstance(node, vy_ast.Import): - self._handle_Import(node) - elif isinstance(node, vy_ast.ImportFrom): - self._handle_ImportFrom(node) + with tag_exceptions(node): + if isinstance(node, vy_ast.Import): + self._handle_Import(node) + elif isinstance(node, vy_ast.ImportFrom): + self._handle_ImportFrom(node) self.seen.add(id(module_ast)) def _handle_Import(self, node: vy_ast.Import): @@ -148,11 +149,10 @@ def _handle_ImportFrom(self, node: vy_ast.ImportFrom): def _add_import( self, node: vy_ast.VyperNode, level: int, qualified_module_name: str, alias: str ) -> None: - with tag_exceptions(node): - compiler_input, ast = self._load_import(node, level, qualified_module_name, alias) - node._metadata["import_info"] = ImportInfo( - alias, qualified_module_name, compiler_input, ast - ) + compiler_input, ast = self._load_import(node, level, qualified_module_name, alias) + node._metadata["import_info"] = ImportInfo( + alias, qualified_module_name, compiler_input, ast + ) # load an InterfaceT or ModuleInfo from an import. # raises FileNotFoundError