1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* parse.y (mlhs_basic): include mlhs_post for ripper. a patch

from Michael Edgar at [ruby-core:35078].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-02-05 12:47:16 +00:00
parent dd9341f02b
commit 476ba90835
3 changed files with 23 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Sat Feb 5 21:47:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (mlhs_basic): include mlhs_post for ripper. a patch
from Michael Edgar at [ruby-core:35078].
Sat Feb 5 21:22:21 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit/assertions.rb (assert_block): move from

View file

@ -1518,7 +1518,8 @@ mlhs_basic : mlhs_head
/*%%%*/
$$ = NEW_MASGN($1, NEW_POSTARG(-1, $4));
/*%
$$ = mlhs_add_star($1, Qnil);
$1 = mlhs_add_star($1, Qnil);
$$ = mlhs_add($1, $4);
%*/
}
| tSTAR mlhs_node
@ -1534,7 +1535,8 @@ mlhs_basic : mlhs_head
/*%%%*/
$$ = NEW_MASGN(0, NEW_POSTARG($2,$4));
/*%
$$ = mlhs_add_star(mlhs_new(), $2);
$2 = mlhs_add_star(mlhs_new(), $2);
$$ = mlhs_add($2, $4);
%*/
}
| tSTAR
@ -1551,6 +1553,7 @@ mlhs_basic : mlhs_head
$$ = NEW_MASGN(0, NEW_POSTARG(-1, $3));
/*%
$$ = mlhs_add_star(mlhs_new(), Qnil);
$$ = mlhs_add($$, $3);
%*/
}
;

View file

@ -368,6 +368,7 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
def test_mlhs_add_star
bug2232 = '[ruby-core:26163]'
bug4364 = '[ruby-core:35078]'
thru_mlhs_add_star = false
tree = parse("a, *b = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true}
@ -377,6 +378,18 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
tree = parse("a, *b, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true}
assert_equal true, thru_mlhs_add_star
assert_match(/mlhs_add\(mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\),mlhs_add\(mlhs_new\(\),c\)\)/, tree, bug2232)
thru_mlhs_add_star = false
tree = parse("a, *, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true}
assert_equal true, thru_mlhs_add_star
assert_match(/mlhs_add\(mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\)\),mlhs_add\(mlhs_new\(\),c\)\)/, tree, bug4364)
thru_mlhs_add_star = false
tree = parse("*b, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true}
assert_equal true, thru_mlhs_add_star
assert_match(/mlhs_add\(mlhs_add_star\(mlhs_new\(\),b\),mlhs_add\(mlhs_new\(\),c\)\)/, tree, bug4364)
thru_mlhs_add_star = false
tree = parse("*, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true}
assert_equal true, thru_mlhs_add_star
assert_match(/mlhs_add\(mlhs_add_star\(mlhs_new\(\)\),mlhs_add\(mlhs_new\(\),c\)\)/, tree, bug4364)
end
def test_mlhs_new