[PRISM] Fix flaky memory in scope nodes
This commit is contained in:
parent
8688256522
commit
e96c838ca4
@ -2439,6 +2439,10 @@ pm_compile_pattern(rb_iseq_t *iseq, pm_scope_node_t *scope_node, const pm_node_t
|
|||||||
void
|
void
|
||||||
pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_t *previous, const pm_parser_t *parser)
|
pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_t *previous, const pm_parser_t *parser)
|
||||||
{
|
{
|
||||||
|
// This is very important, otherwise the scope node could be seen as having
|
||||||
|
// certain flags set that _should not_ be set.
|
||||||
|
memset(scope, 0, sizeof(pm_scope_node_t));
|
||||||
|
|
||||||
scope->base.type = PM_SCOPE_NODE;
|
scope->base.type = PM_SCOPE_NODE;
|
||||||
scope->base.location.start = node->location.start;
|
scope->base.location.start = node->location.start;
|
||||||
scope->base.location.end = node->location.end;
|
scope->base.location.end = node->location.end;
|
||||||
@ -2446,17 +2450,10 @@ pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_
|
|||||||
scope->previous = previous;
|
scope->previous = previous;
|
||||||
scope->parser = parser;
|
scope->parser = parser;
|
||||||
scope->ast_node = (pm_node_t *)node;
|
scope->ast_node = (pm_node_t *)node;
|
||||||
scope->parameters = NULL;
|
|
||||||
scope->body = NULL;
|
|
||||||
scope->constants = NULL;
|
|
||||||
scope->local_table_for_iseq_size = 0;
|
|
||||||
|
|
||||||
if (previous) {
|
if (previous) {
|
||||||
scope->constants = previous->constants;
|
scope->constants = previous->constants;
|
||||||
}
|
}
|
||||||
scope->index_lookup_table = NULL;
|
|
||||||
|
|
||||||
pm_constant_id_list_init(&scope->locals);
|
|
||||||
|
|
||||||
switch (PM_NODE_TYPE(node)) {
|
switch (PM_NODE_TYPE(node)) {
|
||||||
case PM_BLOCK_NODE: {
|
case PM_BLOCK_NODE: {
|
||||||
@ -2541,7 +2538,7 @@ pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_
|
|||||||
default:
|
default:
|
||||||
assert(false && "unreachable");
|
assert(false && "unreachable");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
exclude(:test_tracepoint_nested_enabled_with_target, "unknown")
|
|
||||||
exclude(:test_allow_reentry, "unknown")
|
|
||||||
exclude(:test_tp_rescue, "unknown")
|
|
Loading…
x
Reference in New Issue
Block a user