summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--parse.y7
-rw-r--r--test/ripper/test_parser_events.rb13
3 files changed, 23 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b18f13cc8d..0ac400aeb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/parse.y b/parse.y
index a819c4852c..e0bb2d8f5c 100644
--- a/parse.y
+++ b/parse.y
@@ -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);
%*/
}
;
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 7cf56546ca..829b40562f 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -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