summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-12 04:50:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-12 04:50:14 +0000
commite7f88ff68438bf1bc490515a41ea4f1f1a7f4769 (patch)
tree715648b60cc8621bbcd978b55f66378492933dcb /compile.c
parent8076928003ff0fe6541c6f06da18f365c1e79b44 (diff)
compile.c: check error in when_vals
* compile.c (when_vals): return a negative value on error. * compile.c (compile_case): check error in when_vals(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 52d74da741..244ab18d2c 100644
--- a/compile.c
+++ b/compile.c
@@ -4067,7 +4067,7 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR *const cond_seq, const NODE *vals,
ADD_INSN1(cond_seq, nd_line(val), putobject, lit);
}
else {
- COMPILE(cond_seq, "when cond", val);
+ if (!COMPILE(cond_seq, "when cond", val)) return -1;
}
ADD_INSN1(cond_seq, nd_line(vals), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
@@ -4994,6 +4994,7 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_nod
switch (nd_type(vals)) {
case NODE_ARRAY:
only_special_literals = when_vals(iseq, cond_seq, vals, l1, only_special_literals, literals);
+ if (only_special_literals < 0) return COMPILE_NG;
break;
case NODE_SPLAT:
case NODE_ARGSCAT: