[前][次][番号順一覧][スレッド一覧]

ruby-changes:52107

From: nobu <ko1@a...>
Date: Sun, 12 Aug 2018 13:50:20 +0900 (JST)
Subject: [ruby-changes:52107] nobu:r64315 (trunk): compile.c: check error in when_vals

nobu	2018-08-12 13:50:14 +0900 (Sun, 12 Aug 2018)

  New Revision: 64315

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64315

  Log:
    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().

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 64314)
+++ compile.c	(revision 64315)
@@ -4067,7 +4067,7 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR * https://github.com/ruby/ruby/blob/trunk/compile.c#L4067
 	    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_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L4994
 	    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:

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]