Skip to content

Commit

Permalink
fix public constant annotation
Browse files Browse the repository at this point in the history
move ast expansion to before local validation
  • Loading branch information
charles-cooper committed Jul 25, 2023
1 parent 019a37a commit 0480d2b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion vyper/ast/expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def generate_public_variable_getters(vyper_module: vy_ast.Module) -> None:
# the base return statement is an `Attribute` node, e.g. `self.<var_name>`
# for each input type we wrap it in a `Subscript` to access a specific member
return_stmt = vy_ast.Attribute(value=vy_ast.Name(id="self"), attr=func_type.name)
return_stmt._metadata["type"] = node._metadata["type"]

for i, type_ in enumerate(input_types):
if not isinstance(annotation, vy_ast.Subscript):
Expand Down
1 change: 0 additions & 1 deletion vyper/compiler/phases.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def generate_folded_ast(
vyper_module_folded = copy.deepcopy(vyper_module)
vy_ast.folding.fold(vyper_module_folded)
validate_semantics(vyper_module_folded, interface_codes)
vy_ast.expansion.expand_annotated_ast(vyper_module_folded)
symbol_tables = set_data_positions(vyper_module_folded, storage_layout_overrides)

return vyper_module_folded, symbol_tables
Expand Down
3 changes: 3 additions & 0 deletions vyper/semantics/analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import vyper.ast as vy_ast

from .. import types # break a dependency cycle.
from ..namespace import get_namespace
from .local import validate_functions
Expand All @@ -11,4 +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)
validate_functions(vyper_ast)

0 comments on commit 0480d2b

Please sign in to comment.