Skip to content

Commit 7b23e44

Browse files
Validate ModuleNode
1 parent bc5f85d commit 7b23e44

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/prism.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19307,6 +19307,8 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
1930719307
pm_parser_err_token(parser, &module_keyword, PM_ERR_MODULE_IN_METHOD);
1930819308
}
1930919309

19310+
PM_VALIDATE_NODE_TYPE(parser, constant_path, PM_CONSTANT_PATH_NODE, PM_CONSTANT_READ_NODE);
19311+
1931019312
pop_block_exits(parser, previous_block_exits);
1931119313
pm_node_list_free(&current_block_exits);
1931219314

test/prism/result/error_recovery_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def test_module_node_constant_path_missing
9898

9999
node = result.value.statements.body.first.body.body.first
100100
assert_kind_of ErrorRecoveryNode, node.constant_path
101+
assert_nil node.constant_path.child
101102
end
102103

103104
def test_multi_target_node_lefts_back_reference

0 commit comments

Comments
 (0)