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
This commit is contained in:
nobu 2018-08-12 04:50:14 +00:00
Родитель 8076928003
Коммит e7f88ff684
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -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: