summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-17 08:25:34 +0000
committerrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-17 08:25:34 +0000
commit451e0a6ee1362b4cfc504087f0d3232bbaeb76ca (patch)
treebe81c44d7fb1a44a7e8aec17023361f1ce24416b /compile.c
parentc49060b1d91c794275877572460080b9fd5bceab (diff)
compile.c: do not emit numeric literal range in void context
A fix-up for r56316. Fix stack consistency error on '1..3; nil'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index 7de1da8694..d437be3028 100644
--- a/compile.c
+++ b/compile.c
@@ -6001,9 +6001,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe
NODE *b = node->nd_beg;
NODE *e = node->nd_end;
if (number_literal_p(b) && number_literal_p(e)) {
- VALUE val = rb_range_new(b->nd_lit, e->nd_lit, excl);
- iseq_add_mark_object_compile_time(iseq, val);
- ADD_INSN1(ret, line, putobject, val);
+ if (!popped) {
+ VALUE val = rb_range_new(b->nd_lit, e->nd_lit, excl);
+ iseq_add_mark_object_compile_time(iseq, val);
+ ADD_INSN1(ret, line, putobject, val);
+ }
break;
}
COMPILE(ret, "min", (NODE *) node->nd_beg);