зеркало из https://github.com/github/ruby.git
Use Qtrue/Qfalse instead of 1/0 for 2nd operand to getconstant
Fixes error when using -Werror,-Wshorten-64-to-32.
This commit is contained in:
Родитель
d053a57014
Коммит
6ac6de84ac
14
compile.c
14
compile.c
|
@ -4404,18 +4404,18 @@ compile_const_prefix(rb_iseq_t *iseq, const NODE *const node,
|
|||
switch (nd_type(node)) {
|
||||
case NODE_CONST:
|
||||
debugi("compile_const_prefix - colon", node->nd_vid);
|
||||
ADD_INSN2(body, nd_line(node), getconstant, ID2SYM(node->nd_vid), 1);
|
||||
ADD_INSN2(body, nd_line(node), getconstant, ID2SYM(node->nd_vid), Qtrue);
|
||||
break;
|
||||
case NODE_COLON3:
|
||||
debugi("compile_const_prefix - colon3", node->nd_mid);
|
||||
ADD_INSN(body, nd_line(node), pop);
|
||||
ADD_INSN1(body, nd_line(node), putobject, rb_cObject);
|
||||
ADD_INSN2(body, nd_line(node), getconstant, ID2SYM(node->nd_mid), 1);
|
||||
ADD_INSN2(body, nd_line(node), getconstant, ID2SYM(node->nd_mid), Qtrue);
|
||||
break;
|
||||
case NODE_COLON2:
|
||||
CHECK(compile_const_prefix(iseq, node->nd_head, pref, body));
|
||||
debugi("compile_const_prefix - colon2", node->nd_mid);
|
||||
ADD_INSN2(body, nd_line(node), getconstant, ID2SYM(node->nd_mid), 0);
|
||||
ADD_INSN2(body, nd_line(node), getconstant, ID2SYM(node->nd_mid), Qfalse);
|
||||
break;
|
||||
default:
|
||||
CHECK(COMPILE(pref, "const colon2 prefix", node));
|
||||
|
@ -7154,7 +7154,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
|
|||
ADD_INSNL(ret, line, branchunless, lassign); /* cref */
|
||||
}
|
||||
ADD_INSN(ret, line, dup); /* cref cref */
|
||||
ADD_INSN2(ret, line, getconstant, ID2SYM(mid), 1); /* cref obj */
|
||||
ADD_INSN2(ret, line, getconstant, ID2SYM(mid), Qtrue); /* cref obj */
|
||||
|
||||
if (node->nd_aid == idOROP || node->nd_aid == idANDOP) {
|
||||
lfin = NEW_LABEL(line);
|
||||
|
@ -7500,13 +7500,13 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
|
|||
int ic_index = body->is_size++;
|
||||
|
||||
ADD_INSN2(ret, line, opt_getinlinecache, lend, INT2FIX(ic_index));
|
||||
ADD_INSN2(ret, line, getconstant, ID2SYM(node->nd_vid), 1);
|
||||
ADD_INSN2(ret, line, getconstant, ID2SYM(node->nd_vid), Qtrue);
|
||||
ADD_INSN1(ret, line, opt_setinlinecache, INT2FIX(ic_index));
|
||||
ADD_LABEL(ret, lend);
|
||||
}
|
||||
else {
|
||||
ADD_INSN(ret, line, putnil);
|
||||
ADD_INSN2(ret, line, getconstant, ID2SYM(node->nd_vid), 1);
|
||||
ADD_INSN2(ret, line, getconstant, ID2SYM(node->nd_vid), Qtrue);
|
||||
}
|
||||
|
||||
if (popped) {
|
||||
|
@ -7893,7 +7893,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
|
|||
}
|
||||
|
||||
ADD_INSN1(ret, line, putobject, rb_cObject);
|
||||
ADD_INSN2(ret, line, getconstant, ID2SYM(node->nd_mid), 1);
|
||||
ADD_INSN2(ret, line, getconstant, ID2SYM(node->nd_mid), Qtrue);
|
||||
|
||||
if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
|
||||
ADD_INSN1(ret, line, opt_setinlinecache, INT2FIX(ic_index));
|
||||
|
|
|
@ -264,7 +264,7 @@ getconstant
|
|||
/* getconstant can kick autoload */
|
||||
// attr bool leaf = false; /* has rb_autoload_load() */
|
||||
{
|
||||
val = vm_get_ev_const(ec, klass, id, allow_nil, 0);
|
||||
val = vm_get_ev_const(ec, klass, id, allow_nil == Qtrue, 0);
|
||||
}
|
||||
|
||||
/* Set constant variable id under cbase class or module.
|
||||
|
|
Загрузка…
Ссылка в новой задаче