Project

General

Profile

Feature #20993 ยป feature-20993.diff

nobu (Nobuyoshi Nakada), 12/30/2024 01:04 PM

View differences:

w/parse.y
p->ctxt.cant_return = $k_class.cant_return;
p->ctxt.shareable_constant_value = $k_class.shareable_constant_value;
}
| k_class cpath '=' primary_value[cdef] term
{
begin_definition("class", &@k_class, &@cpath);
YYLTYPE loc = code_loc_gen(&@cpath, &@cdef);
$$ = const_decl(p, $cpath, &@cpath);
$$ = node_assign(p, $$, $cdef, NO_LEX_CTXT, &loc);
$$ = NEW_BEGIN($$, &loc);
/*% ripper: stmts_add!(stmts_new!, assign!($:cpath, $:cdef)) %*/
}[cdecl]<node>
bodystmt
k_end
{
$$ = NEW_CLASS($cpath, $bodystmt, 0, &@$);
nd_set_line(RNODE_CLASS($$)->nd_body, @k_end.end_pos.lineno);
set_line_body($bodystmt, @cdef.end_pos.lineno);
nd_set_line($$, @cdef.end_pos.lineno);
/*% ripper: class!($:cpath, Qnil, $:bodystmt) %*/
local_pop(p);
p->ctxt.in_class = $k_class.in_class;
p->ctxt.cant_return = $k_class.cant_return;
p->ctxt.shareable_constant_value = $k_class.shareable_constant_value;
/*% ripper: stmts_add!($:cdecl, $:$) %*/
$$ = block_append(p, $cdecl, $$);
}
| k_class tLSHFT expr_value
{
begin_definition("", &@k_class, &@tLSHFT);
......
p->ctxt.cant_return = $k_module.cant_return;
p->ctxt.shareable_constant_value = $k_module.shareable_constant_value;
}
| k_module cpath '=' primary_value[cdef] term
{
begin_definition("module", &@k_module, &@cpath);
YYLTYPE loc = code_loc_gen(&@cpath, &@cdef);
$$ = const_decl(p, $cpath, &@cpath);
$$ = node_assign(p, $$, $cdef, NO_LEX_CTXT, &loc);
$$ = NEW_BEGIN($$, &loc);
/*% ripper: stmts_add!(stmts_new!, assign!($:cpath, $:cdef)) %*/
}[cdecl]<node>
bodystmt
k_end
{
$$ = NEW_MODULE($cpath, $bodystmt, &@$);
nd_set_line(RNODE_MODULE($$)->nd_body, @k_end.end_pos.lineno);
set_line_body($bodystmt, @cpath.end_pos.lineno);
nd_set_line($$, @cpath.end_pos.lineno);
/*% ripper: module!($:cpath, $:bodystmt) %*/
local_pop(p);
p->ctxt.in_class = $k_module.in_class;
p->ctxt.cant_return = $k_module.cant_return;
p->ctxt.shareable_constant_value = $k_module.shareable_constant_value;
/*% ripper: stmts_add!($:cdecl, $:$) %*/
$$ = block_append(p, $cdecl, $$);
}
| defn_head[head]
f_arglist[args]
{
    (1-1/1)