[Prism] Fix local variable access for POST_EXECUTION_NODE

This commit is contained in:
Matt Valentine-House 2023-11-30 12:05:48 +00:00
parent 57782d3d47
commit 0c7c654b4d
2 changed files with 3 additions and 0 deletions

View File

@ -1398,6 +1398,7 @@ pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_
case PM_POST_EXECUTION_NODE: {
pm_post_execution_node_t *cast = (pm_post_execution_node_t *) node;
scope->body = (pm_node_t *) cast->statements;
scope->local_depth_offset += 2;
break;
}
case PM_PROGRAM_NODE: {

View File

@ -883,6 +883,8 @@ module Prism
assert_prism_eval("END { 1 }")
assert_prism_eval("END { @b }; @b = 1")
assert_prism_eval("END { @b; 0 }; @b = 1")
assert_prism_eval("foo = 1; END { foo.nil? }")
assert_prism_eval("foo = 1; END { END { foo.nil? }}")
end
def test_ProgramNode