1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

WB needs to be executed after object is reachable

This commit is contained in:
Aaron Patterson 2019-09-10 11:27:40 -07:00
parent 721cab4706
commit 139510238b
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6
2 changed files with 10 additions and 5 deletions

7
node.h
View file

@ -284,7 +284,12 @@ typedef struct RNode {
#define NEW_DEFN(i,a,d,loc) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d,loc),loc)
#define NEW_DEFS(r,i,a,d,loc) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d,loc),loc)
#define NEW_SCOPE(a,b,loc) NEW_NODE(NODE_SCOPE,local_tbl(p),b,a,loc)
#define NEW_SCOPE(a,b,loc) ({ \
VALUE tbl = 0; \
NODE * _n = NEW_NODE(NODE_SCOPE,local_tbl(p, &tbl),b,a,loc); \
tbl && RB_OBJ_WRITTEN(p->ast, Qnil, tbl); \
_n; \
})
#define NEW_BLOCK(a,loc) NEW_NODE(NODE_BLOCK,a,0,0,loc)
#define NEW_IF(c,t,e,loc) NEW_NODE(NODE_IF,c,t,e,loc)
#define NEW_UNLESS(c,t,e,loc) NEW_NODE(NODE_UNLESS,c,t,e,loc)

View file

@ -465,7 +465,7 @@ static NODE *symbol_append(struct parser_params *p, NODE *symbols, NODE *symbol)
static NODE *match_op(struct parser_params*,NODE*,NODE*,const YYLTYPE*,const YYLTYPE*);
static ID *local_tbl(struct parser_params*);
static ID *local_tbl(struct parser_params*, VALUE *tmp);
static VALUE reg_compile(struct parser_params*, VALUE, int);
static void reg_fragment_setenc(struct parser_params*, VALUE, int);
@ -11144,8 +11144,8 @@ new_args_tail(struct parser_params *p, NODE *kw_args, ID kw_rest_arg, ID block,
args = ZALLOC(struct rb_args_info);
VALUE tmpbuf = rb_imemo_tmpbuf_auto_free_pointer(args);
args->imemo = tmpbuf;
RB_OBJ_WRITTEN(p->ast, Qnil, tmpbuf);
node = NEW_NODE(NODE_ARGS, 0, 0, args, &NULL_LOC);
RB_OBJ_WRITTEN(p->ast, Qnil, tmpbuf);
if (p->error_p) return node;
args->block_arg = block;
@ -11633,7 +11633,7 @@ local_pop(struct parser_params *p)
#ifndef RIPPER
static ID*
local_tbl(struct parser_params *p)
local_tbl(struct parser_params *p, VALUE *tmp)
{
int cnt_args = vtable_size(p->lvtbl->args);
int cnt_vars = vtable_size(p->lvtbl->vars);
@ -11655,8 +11655,8 @@ local_tbl(struct parser_params *p)
buf[0] = cnt;
VALUE tmpbuf = rb_imemo_tmpbuf_auto_free_pointer(buf);
*tmp = tmpbuf;
buf[cnt + 1] = (ID)tmpbuf;
RB_OBJ_WRITTEN(p->ast, Qnil, tmpbuf);
return buf;
}