diff --git a/ChangeLog b/ChangeLog index 6bf1feb964..13dc60df1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Aug 15 13:42:15 2007 Koichi Sasada + + * parse.y: fix rules around f_margs. "make test" passes all tests. + + * bootstraptest/test_block.rb: add some tests for above. + Wed Aug 15 13:50:10 2007 Nobuyoshi Nakada * hash.c (rb_hash_delete_key): delete the entry without calling block. @@ -9,7 +15,7 @@ Wed Aug 15 13:50:10 2007 Nobuyoshi Nakada Wed Aug 15 13:39:25 2007 Koichi Sasada - * process.c (proc_geteuid): fix strange cast. [ruby-dev:31417] + * process.c (proc_geteuid): fix strange conversion. [ruby-dev:31417] Wed Aug 15 01:05:55 2007 Tanaka Akira diff --git a/bootstraptest/test_block.rb b/bootstraptest/test_block.rb index 96d78cc965..747a48fdaa 100644 --- a/bootstraptest/test_block.rb +++ b/bootstraptest/test_block.rb @@ -336,7 +336,6 @@ assert_equal %q{[1, nil]}, %q{ } } -# block parameter (shouldn't SEGV: [ruby-dev:31143]) assert_equal '0', %q{ def m() end @@ -364,31 +363,28 @@ m {|(v0,*v1,v2),*,v3,&v4|} m {|(v0, *v1, v2)|} m {|(*,v)|} 0 -} +}, "block parameter (shouldn't SEGV: [ruby-dev:31143])" -# [ruby-dev:31147] assert_equal 'nil', %q{ def m yield end m{|&b| b}.inspect -} +}, '[ruby-dev:31147]' -# [ruby-dev:31160] assert_equal 'nil', %q{ def m() yield end m {|(v,(*))|}.inspect -} +}, '[ruby-dev:31160]' -# [ruby-dev:31153] assert_equal 'nil', %q{ def m() yield end m {|(*,a,b)|}.inspect -} +}, '[ruby-dev:31153]' assert_equal 'nil', %q{ def m() @@ -397,3 +393,20 @@ assert_equal 'nil', %q{ m {|((*))|}.inspect } +assert_equal %q{[1, 1, [1, nil], [1, nil], [1, nil], [1, nil], [1, 1], 1, [1, nil], [1, nil], [1, nil], [1, nil], [[1, 1], [1, 1]], [1, 1], [1, 1], [1, 1], [1, nil], [1, nil], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[1, 1], [1, 1]], [[1, 1], [1, 1]], [[1, 1], [1, 1]], [1, 1], [1, 1], [[[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[1, 1], [1, 1]], [[1, 1], [1, 1]]]}, %q{ +def m(ary = []) + yield(ary) +end + +$ans = [] +o = 1 +5.times{ + v,(*) = o; $ans << o + m(o){|(v,(*))| $ans << v} + ((x, y)) = o; $ans << [x, y] + m(o){|((x, y))| $ans << [x, y]} + (((x, y))) = o; $ans << [x, y] + m(o){|(((x, y)))| $ans << [x, y]} + o = [o, o] +}; $ans +} diff --git a/debug.c b/debug.c index b5a014e1cb..9943935e21 100644 --- a/debug.c +++ b/debug.c @@ -33,7 +33,7 @@ ruby_debug_print_value(int level, int debug_level, const char *header, VALUE obj VALUE str; str = rb_inspect(obj); fprintf(stderr, "DBG> %s: %s\n", header, - obj == -1 ? "" : StringValueCStr(str)); + obj == -1 ? "" : StringValueCStr(str)); fflush(stderr); } return obj; diff --git a/parse.y b/parse.y index 9b90ff320d..ef7d3e6ee6 100644 --- a/parse.y +++ b/parse.y @@ -1389,7 +1389,7 @@ mlhs_basic : mlhs_head | mlhs_head tSTAR ',' mlhs_post { /*%%%*/ - $$ = NEW_MASGN($1, NEW_POSTARG(-1,$4)); + $$ = NEW_MASGN($1, NEW_POSTARG(-1, $4)); /*% $$ = mlhs_add_star($1, Qnil); %*/ @@ -1421,7 +1421,7 @@ mlhs_basic : mlhs_head | tSTAR ',' mlhs_post { /*%%%*/ - $$ = NEW_MASGN(0, NEW_POSTARG(-1,$3)); + $$ = NEW_MASGN(0, NEW_POSTARG(-1, $3)); /*% $$ = mlhs_add_star(mlhs_new(), Qnil); %*/ @@ -3001,7 +3001,7 @@ for_var : lhs f_marg : f_norm_arg { /*%%%*/ - $$ = NEW_LIST(assignable($1, 0)); + $$ = assignable($1, 0); //NEW_LIST(assignable($1, 0)); /*% $$ = dispatch1(mlhs_paren, $1); %*/ @@ -3009,7 +3009,7 @@ f_marg : f_norm_arg | tLPAREN f_margs rparen { /*%%%*/ - $$ = NEW_MASGN(NEW_LIST($2), 0); + $$ = $2; //NEW_LIST($2); /*% $$ = dispatch1(mlhs_paren, $2); %*/ @@ -3019,7 +3019,7 @@ f_marg : f_norm_arg f_marg_list : f_marg { /*%%%*/ - $$ = $1; + $$ = NEW_LIST($1); /*% $$ = mlhs_add(mlhs_new(), $1); %*/