Skip to content

Commit

Permalink
wip: dealing with exit_to
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Jan 19, 2022
1 parent 617bc8d commit ec3ccaa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vyper/codegen/stmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,5 +456,11 @@ def parse_body(code, context):
for stmt in code:
lll = parse_stmt(stmt, context)
lll_node.append(lll)
lll_node.append("pass") # force zerovalent, even last statement

# force using the return routine / exit_to cleanup for end of function
if context.return_type is None and lll_node[-1].value != "exit_to":
lll_node.append(parse_stmt(vy_ast.Return(None), context))

# force zerovalent, even last statement
lll_node.append("pass") # CMC 2022-01-16 is this necessary?
return LLLnode.from_list(lll_node, pos=getpos(code[0]) if code else None)
1 change: 1 addition & 0 deletions vyper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def in_bounds(cls, type_str, value):
}

# List of valid LLL macros.
# TODO move this somewhere else, like lll_node.py
VALID_LLL_MACROS = {
"assert",
"break",
Expand Down

0 comments on commit ec3ccaa

Please sign in to comment.