summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-09 01:49:40 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-09 01:49:40 +0000
commitda4067bab843a7fbddfc8cc1e7672e673165c715 (patch)
tree64616a43832472fd2946f5a6044f3b214d166ab9 /compile.c
parent580424d53395ba7ef8f37e200d85f6e66abe7671 (diff)
parse.y: Remove special handling of tOROP and tANDOP
The complexity is no longer considered necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/compile.c b/compile.c
index d81cc0fa10..3d94cf1bad 100644
--- a/compile.c
+++ b/compile.c
@@ -5748,9 +5748,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
ADD_SEND_WITH_FLAG(ret, line, idAREF, argc, INT2FIX(flag));
flag |= asgnflag;
- if (id == 0 || id == 1) {
- /* 0: or, 1: and
- a[x] ||= y
+ if (id == idOROP || id == idANDOP) {
+ /* a[x] ||= y or a[x] &&= y
unless/if a[x]
a[x]= y
@@ -5762,12 +5761,10 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
LABEL *lfin = NEW_LABEL(line);
ADD_INSN(ret, line, dup);
- if (id == 0) {
- /* or */
+ if (id == idOROP) {
ADD_INSNL(ret, line, branchif, label);
}
- else {
- /* and */
+ else { /* idANDOP */
ADD_INSNL(ret, line, branchunless, label);
}
ADD_INSN(ret, line, pop);
@@ -5894,12 +5891,12 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
ADD_INSN(ret, line, dup);
ADD_SEND(ret, line, vid, INT2FIX(0));
- if (atype == 0 || atype == 1) { /* 0: OR or 1: AND */
+ if (atype == idOROP || atype == idANDOP) {
ADD_INSN(ret, line, dup);
- if (atype == 0) {
+ if (atype == idOROP) {
ADD_INSNL(ret, line, branchif, lcfin);
}
- else {
+ else { /* idANDOP */
ADD_INSNL(ret, line, branchunless, lcfin);
}
ADD_INSN(ret, line, pop);
@@ -5959,7 +5956,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
}
mid = node->nd_head->nd_mid;
/* cref */
- if (node->nd_aid == 0) {
+ if (node->nd_aid == idOROP) {
lassign = NEW_LABEL(line);
ADD_INSN(ret, line, dup); /* cref cref */
ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_CONST),
@@ -5969,12 +5966,12 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
ADD_INSN(ret, line, dup); /* cref cref */
ADD_INSN1(ret, line, getconstant, ID2SYM(mid)); /* cref obj */
- if (node->nd_aid == 0 || node->nd_aid == 1) {
+ if (node->nd_aid == idOROP || node->nd_aid == idANDOP) {
lfin = NEW_LABEL(line);
if (!popped) ADD_INSN(ret, line, dup); /* cref [obj] obj */
- if (node->nd_aid == 0)
+ if (node->nd_aid == idOROP)
ADD_INSNL(ret, line, branchif, lfin);
- else
+ else /* idANDOP */
ADD_INSNL(ret, line, branchunless, lfin);
/* cref [obj] */
if (!popped) ADD_INSN(ret, line, pop); /* cref */