diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-07 10:56:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-07 10:56:22 +0000 |
commit | 249fd9e0b7ddbb3637db111637c2cea355115c32 (patch) | |
tree | a2cd680bdc2629bb6f3b24cf2e01cee0fde28d8d | |
parent | d69d98f61a9e58b03ae2d8c195f0f97e8c04080a (diff) | |
download | ruby-249fd9e0b7ddbb3637db111637c2cea355115c32.tar.gz |
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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 9 |
2 files changed, 10 insertions, 1 deletions
@@ -10455,7 +10455,7 @@ reg_named_capture_assign_iter(const OnigUChar *name, const OnigUChar *name_end, 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); diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 112af60c96..2c4c9709f7 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -205,6 +205,15 @@ class TestRegexp < Test::Unit::TestCase 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") |