* compile.c (iseq_compile_each): fixed indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
893af1e3b6
commit
c809aaa5e1
194
compile.c
194
compile.c
@ -3565,8 +3565,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case NODE_MASGN:{
|
case NODE_MASGN:{
|
||||||
compile_massign(iseq, ret, node, poped);
|
compile_massign(iseq, ret, node, poped);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NODE_LASGN:{
|
case NODE_LASGN:{
|
||||||
@ -3650,45 +3650,45 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NODE_OP_ASGN1: {
|
case NODE_OP_ASGN1: {
|
||||||
DECL_ANCHOR(args);
|
DECL_ANCHOR(args);
|
||||||
VALUE argc;
|
VALUE argc;
|
||||||
unsigned long flag = 0;
|
unsigned long flag = 0;
|
||||||
ID id = node->nd_mid;
|
ID id = node->nd_mid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* a[x] (op)= y
|
* a[x] (op)= y
|
||||||
*
|
*
|
||||||
* eval a # a
|
* eval a # a
|
||||||
* eval x # a x
|
* eval x # a x
|
||||||
* dupn 2 # a x a x
|
* dupn 2 # a x a x
|
||||||
* send :[] # a x a[x]
|
* send :[] # a x a[x]
|
||||||
* eval y # a x a[x] y
|
* eval y # a x a[x] y
|
||||||
* send op # a x a[x]+y
|
* send op # a x a[x]+y
|
||||||
* send []= # ret
|
* send []= # ret
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nd_recv[nd_args->nd_body] (nd_mid)= nd_args->nd_head;
|
* nd_recv[nd_args->nd_body] (nd_mid)= nd_args->nd_head;
|
||||||
* NODE_OP_ASGN nd_recv
|
* NODE_OP_ASGN nd_recv
|
||||||
* nd_args->nd_head
|
* nd_args->nd_head
|
||||||
* nd_args->nd_body
|
* nd_args->nd_body
|
||||||
* nd_mid
|
* nd_mid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
COMPILE(ret, "NODE_OP_ASGN1 recv", node->nd_recv);
|
COMPILE(ret, "NODE_OP_ASGN1 recv", node->nd_recv);
|
||||||
if (nd_type(node->nd_args->nd_body) != NODE_ZARRAY) {
|
if (nd_type(node->nd_args->nd_body) != NODE_ZARRAY) {
|
||||||
INIT_ANCHOR(args);
|
INIT_ANCHOR(args);
|
||||||
argc = setup_args(iseq, args, node->nd_args->nd_body, &flag);
|
argc = setup_args(iseq, args, node->nd_args->nd_body, &flag);
|
||||||
ADD_SEQ(ret, args);
|
ADD_SEQ(ret, args);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
argc = INT2FIX(0);
|
argc = INT2FIX(0);
|
||||||
}
|
}
|
||||||
ADD_INSN1(ret, nd_line(node), dupn, INT2FIX(FIX2INT(argc)+1));
|
ADD_INSN1(ret, nd_line(node), dupn, INT2FIX(FIX2INT(argc)+1));
|
||||||
ADD_SEND_R(ret, nd_line(node), ID2SYM(idAREF), argc, Qfalse, LONG2FIX(flag));
|
ADD_SEND_R(ret, nd_line(node), ID2SYM(idAREF), argc, Qfalse, LONG2FIX(flag));
|
||||||
|
|
||||||
if (id == 0 || id == 1) {
|
if (id == 0 || id == 1) {
|
||||||
/* 0: or, 1: and
|
/* 0: or, 1: and
|
||||||
a[x] ||= y
|
a[x] ||= y
|
||||||
|
|
||||||
unless/if a[x]
|
unless/if a[x]
|
||||||
@ -3696,64 +3696,64 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
|||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
*/
|
*/
|
||||||
LABEL *label = NEW_LABEL(nd_line(node));
|
LABEL *label = NEW_LABEL(nd_line(node));
|
||||||
LABEL *lfin = NEW_LABEL(nd_line(node));
|
LABEL *lfin = NEW_LABEL(nd_line(node));
|
||||||
|
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
/* or */
|
/* or */
|
||||||
ADD_INSN(ret, nd_line(node), dup);
|
ADD_INSN(ret, nd_line(node), dup);
|
||||||
ADD_INSNL(ret, nd_line(node), branchif, label);
|
ADD_INSNL(ret, nd_line(node), branchif, label);
|
||||||
ADD_INSN(ret, nd_line(node), pop);
|
ADD_INSN(ret, nd_line(node), pop);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* and */
|
/* and */
|
||||||
ADD_INSN(ret, nd_line(node), dup);
|
ADD_INSN(ret, nd_line(node), dup);
|
||||||
ADD_INSNL(ret, nd_line(node), branchunless, label);
|
ADD_INSNL(ret, nd_line(node), branchunless, label);
|
||||||
ADD_INSN(ret, nd_line(node), pop);
|
ADD_INSN(ret, nd_line(node), pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
COMPILE(ret, "NODE_OP_ASGN1 args->head: ", node->nd_args->nd_head);
|
COMPILE(ret, "NODE_OP_ASGN1 args->head: ", node->nd_args->nd_head);
|
||||||
if (flag & VM_CALL_ARGS_SPLAT_BIT) {
|
if (flag & VM_CALL_ARGS_SPLAT_BIT) {
|
||||||
ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
|
ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
|
||||||
ADD_INSN(ret, nd_line(node), concatarray);
|
ADD_INSN(ret, nd_line(node), concatarray);
|
||||||
ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
|
ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
|
||||||
argc, Qfalse, LONG2FIX(flag));
|
argc, Qfalse, LONG2FIX(flag));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
|
ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
|
||||||
INT2FIX(FIX2INT(argc) + 1), Qfalse, LONG2FIX(flag));
|
INT2FIX(FIX2INT(argc) + 1), Qfalse, LONG2FIX(flag));
|
||||||
}
|
}
|
||||||
ADD_INSNL(ret, nd_line(node), jump, lfin);
|
ADD_INSNL(ret, nd_line(node), jump, lfin);
|
||||||
ADD_LABEL(ret, label);
|
ADD_LABEL(ret, label);
|
||||||
if (id == 0 || id == 1) { /* 0: or, 1: and */
|
if (id == 0 || id == 1) { /* 0: or, 1: and */
|
||||||
ADD_INSN(ret, nd_line(node), swap);
|
ADD_INSN(ret, nd_line(node), swap);
|
||||||
ADD_INSN(ret, nd_line(node), pop);
|
ADD_INSN(ret, nd_line(node), pop);
|
||||||
ADD_INSN(ret, nd_line(node), swap);
|
ADD_INSN(ret, nd_line(node), swap);
|
||||||
ADD_INSN(ret, nd_line(node), pop);
|
ADD_INSN(ret, nd_line(node), pop);
|
||||||
}
|
}
|
||||||
ADD_LABEL(ret, lfin);
|
ADD_LABEL(ret, lfin);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
COMPILE(ret, "NODE_OP_ASGN1 args->head: ", node->nd_args->nd_head);
|
COMPILE(ret, "NODE_OP_ASGN1 args->head: ", node->nd_args->nd_head);
|
||||||
ADD_SEND(ret, nd_line(node), ID2SYM(id), INT2FIX(1));
|
ADD_SEND(ret, nd_line(node), ID2SYM(id), INT2FIX(1));
|
||||||
if (flag & VM_CALL_ARGS_SPLAT_BIT) {
|
if (flag & VM_CALL_ARGS_SPLAT_BIT) {
|
||||||
ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
|
ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
|
||||||
ADD_INSN(ret, nd_line(node), concatarray);
|
ADD_INSN(ret, nd_line(node), concatarray);
|
||||||
ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
|
ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
|
||||||
argc, Qfalse, LONG2FIX(flag));
|
argc, Qfalse, LONG2FIX(flag));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
|
ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
|
||||||
INT2FIX(FIX2INT(argc) + 1), Qfalse, LONG2FIX(flag));
|
INT2FIX(FIX2INT(argc) + 1), Qfalse, LONG2FIX(flag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poped) {
|
if (poped) {
|
||||||
ADD_INSN(ret, nd_line(node), pop);
|
ADD_INSN(ret, nd_line(node), pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NODE_OP_ASGN2:{
|
case NODE_OP_ASGN2:{
|
||||||
ID atype = node->nd_next->nd_mid;
|
ID atype = node->nd_next->nd_mid;
|
||||||
@ -4407,13 +4407,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NODE_SPLAT:{
|
case NODE_SPLAT:{
|
||||||
COMPILE(ret, "splat", node->nd_head);
|
COMPILE(ret, "splat", node->nd_head);
|
||||||
ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
|
ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
|
||||||
|
|
||||||
if (poped) {
|
if (poped) {
|
||||||
ADD_INSN(ret, nd_line(node), pop);
|
ADD_INSN(ret, nd_line(node), pop);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NODE_DEFN:{
|
case NODE_DEFN:{
|
||||||
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
|
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user