Skip to content

Commit

Permalink
unwarper: Fix slot elimination stack overflow on a cycled AST
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrian Nord authored and Andrian Nord committed Jan 25, 2014
1 parent 33e2876 commit 062c6a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ljd/ast/unwarper.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,19 @@ def _unwarp_expressions_pack(blocks, pack):
replacements[start] = end

slotworks.eliminate_temporary(end)

_set_flow_to(start, end)
else:
blocks = blocks[:start_index + 1] + blocks[end_index:]

start.contents = statements[:split_i]
end.contents = statements[split_i:]

slotworks.eliminate_temporary(start)
# We need to kill the start's warp before slot
# elimination or it could result in a cycled AST.
_set_flow_to(start, end)

_set_flow_to(start, end)
slotworks.eliminate_temporary(start)

return blocks

Expand Down
2 changes: 2 additions & 0 deletions test/expression.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,7 @@ local function foo()
}
end

menu.logbook = foo(x or y) or {}

--[[
--]]

0 comments on commit 062c6a3

Please sign in to comment.