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

ruby-changes:45728

From: nobu <ko1@a...>
Date: Tue, 7 Mar 2017 19:56:28 +0900 (JST)
Subject: [ruby-changes:45728] nobu:r57801 (trunk): parse.y: remove trace

nobu	2017-03-07 19:56:22 +0900 (Tue, 07 Mar 2017)

  New Revision: 57801

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

  Log:
    parse.y: remove trace
    
    * parse.y (reg_named_capture_assign_iter): do not insert trace
      instructions before local variable assinments.  putobject is
      expected at first.  [ruby-core:79940] [Bug #13287]

  Modified files:
    trunk/parse.y
    trunk/test/ruby/test_regexp.rb
Index: parse.y
===================================================================
--- parse.y	(revision 57800)
+++ parse.y	(revision 57801)
@@ -10455,7 +10455,7 @@ reg_named_capture_assign_iter(const Onig https://github.com/ruby/ruby/blob/trunk/parse.y#L10455
         return ST_CONTINUE;
     }
     var = intern_cstr(s, len, enc);
-    node = newline_node(node_assign(assignable(var, 0), NEW_LIT(ID2SYM(var))));
+    node = node_assign(assignable(var, 0), NEW_LIT(ID2SYM(var)));
     succ = arg->succ_block;
     if (!succ) succ = NEW_BEGIN(0);
     succ = block_append(succ, node);
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 57800)
+++ test/ruby/test_regexp.rb	(revision 57801)
@@ -205,6 +205,15 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L205
     assert_not_include(local_variables, :nil, "[ruby-dev:32675]")
   end
 
+  def test_assign_named_capture_trace
+    bug = '[ruby-core:79940] [Bug #13287]'
+    assert_normal_exit("#{<<-"begin;"}\n#{<<-"end;"}", bug)
+    begin;
+      / (?<foo>.*)/ =~ "bar" &&
+        true
+    end;
+  end
+
   def test_match_regexp
     r = /./
     m = r.match("a")

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

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