diff --git a/vyper/ast/expansion.py b/vyper/ast/expansion.py index 6f5cc056ac..4d76451d0e 100644 --- a/vyper/ast/expansion.py +++ b/vyper/ast/expansion.py @@ -5,22 +5,6 @@ from vyper.semantics.types.function import ContractFunctionT -def expand_annotated_ast(vyper_module: vy_ast.Module) -> None: - """ - Perform expansion / simplification operations on an annotated Vyper AST. - - This pass uses annotated type information to modify the AST, simplifying - logic and expanding subtrees to reduce the compexity during codegen. - - Arguments - --------- - vyper_module : Module - Top-level Vyper AST node that has been type-checked and annotated. - """ - generate_public_variable_getters(vyper_module) - remove_unused_statements(vyper_module) - - def generate_public_variable_getters(vyper_module: vy_ast.Module) -> None: """ Create getter functions for public variables. diff --git a/vyper/compiler/phases.py b/vyper/compiler/phases.py index 2edf404af9..b35f45e404 100644 --- a/vyper/compiler/phases.py +++ b/vyper/compiler/phases.py @@ -257,6 +257,7 @@ def generate_folded_ast( StorageLayout Layout of variables in storage """ + vy_ast.expansion.remove_unused_statements(vyper_module) vyper_module_folded = copy.deepcopy(vyper_module) vy_ast.folding.fold(vyper_module_folded) symbol_tables = set_data_positions(vyper_module_folded, storage_layout_overrides) diff --git a/vyper/semantics/analysis/__init__.py b/vyper/semantics/analysis/__init__.py index 9e987d1cd0..0e30c3da1a 100644 --- a/vyper/semantics/analysis/__init__.py +++ b/vyper/semantics/analysis/__init__.py @@ -13,5 +13,5 @@ def validate_semantics(vyper_ast, interface_codes): with namespace.enter_scope(): add_module_namespace(vyper_ast, interface_codes) - vy_ast.expansion.expand_annotated_ast(vyper_ast) + vy_ast.expansion.generate_public_variable_getters(vyper_ast) validate_functions(vyper_ast)