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

ruby-changes:28969

From: nobu <ko1@a...>
Date: Sat, 1 Jun 2013 17:25:16 +0900 (JST)
Subject: [ruby-changes:28969] nobu:r41021 (trunk): compile.c: not simple if keyword args

nobu	2013-06-01 17:25:05 +0900 (Sat, 01 Jun 2013)

  New Revision: 41021

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41021

  Log:
    compile.c: not simple if keyword args
    
    * compile.c (iseq_set_arguments): not a simple single argument if any
      keyword arguments exist.  [ruby-core:55203] [Bug #8463]

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/test/ruby/test_keyword.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41020)
+++ ChangeLog	(revision 41021)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Sat Jun  1 17:21:24 2013  Nobuyoshi Nakada  <nobu@r...>
+Sat Jun  1 17:24:47 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* compile.c (iseq_set_arguments): not a simple single argument if any
+	  keyword arguments exist.  [ruby-core:55203] [Bug #8463]
 
 	* vm_insnhelper.c (vm_yield_setup_block_args): split single parameter
 	  if any keyword arguments exist, and then extract keyword arguments.
Index: compile.c
===================================================================
--- compile.c	(revision 41020)
+++ compile.c	(revision 41021)
@@ -1276,7 +1276,8 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L1276
 	}
 
 	if (iseq->type == ISEQ_TYPE_BLOCK) {
-	    if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 && iseq->arg_rest == -1) {
+	    if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 &&
+		iseq->arg_rest == -1 && iseq->arg_keyword == -1) {
 		if (iseq->argc == 1 && last_comma == 0) {
 		    /* {|a|} */
 		    iseq->arg_simple |= 0x02;
Index: test/ruby/test_keyword.rb
===================================================================
--- test/ruby/test_keyword.rb	(revision 41020)
+++ test/ruby/test_keyword.rb	(revision 41021)
@@ -271,6 +271,8 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L271
     assert_equal(expect, pr.call(expect), bug8463)
     pr = proc {|a, *b, **opt| next a, *b, opt}
     assert_equal(expect, pr.call(expect), bug8463)
+    pr = proc {|a, **opt| next a, opt}
+    assert_equal(expect.values_at(0, -1), pr.call(expect), bug8463)
   end
 
   def test_bare_kwrest

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

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