diff options
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | ext/openssl/ossl_asn1.c | 1 | ||||
-rw-r--r-- | lib/irb/ruby-lex.rb | 3 | ||||
-rw-r--r-- | marshal.c | 55 | ||||
-rw-r--r-- | parse.y | 14 | ||||
-rw-r--r-- | sample/test.rb | 12 |
7 files changed, 80 insertions, 29 deletions
@@ -30,6 +30,23 @@ Sat Oct 4 17:52:59 2003 NAKAMURA, Hiroshi <[email protected]> * test/runner.rb: give testsuite name. +Sat Oct 4 15:16:02 2003 Yukihiro Matsumoto <[email protected]> + + * marshal.c (w_object): instance variable dump do not cause error + for objects that cannot be dumped, if they traversed from + marshal_dump. they are just ignored. + + * gc.c (Init_stack): cast "space" (doble value) into unsigned + int. should run on PowerPC. + + * eval.c (rb_eval): should not execute else part if any exception + is caught. [ruby-dev:21482] + + * parse.y (f_args): should allow unparenthesized block argument. + + * parse.y (f_rest_arg): should allow unparenthesized rest + argument. + Sat Oct 4 14:59:51 2003 Tanaka Akira <[email protected]> * lib/pathname.rb (initialize): raise ArgumentError if argument has @@ -123,6 +140,11 @@ Fri Oct 3 13:02:00 2003 Nathaniel Talbott <[email protected]> * test/testunit/collector/test_objectspace.rb: ditto. +Fri Oct 3 08:14:32 2003 Yukihiro Matsumoto <[email protected]> + + * lib/irb/ruby-lex.rb (RubyLex::identify_identifier): support + 'class ::Foo' syntax. [ruby-talk:83514] + Fri Oct 3 08:01:00 2003 Nathaniel Talbott <[email protected]> * lib/test/unit/assertions.rb: added a default message for #assert, @@ -2828,7 +2828,7 @@ rb_eval(self, n) POP_TAG(); if (state) JUMP_TAG(state); /* no exception raised */ - if (node = node->nd_else) { /* else clause given */ + if (!rescuing && (node = node->nd_else)) { /* else clause given */ goto again; } } diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index 29859367dc..2fe86b68dd 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -788,6 +788,7 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth, break; default: /* use original value */ + break; } } asn1data = rb_funcall(klass, rb_intern("new"), 1, value); diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 5fbcff90ec..6b445a32b9 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -791,8 +791,7 @@ class RubyLex valid = true case token when "class" - valid = false unless peek_match?(/^\s*(<<|\w)/) - + valid = false unless peek_match?(/^\s*(<<|\w|::)/) when "def" valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/) # valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)?=|\&\&|\|\|)/) @@ -93,6 +93,7 @@ struct dump_call_arg { VALUE obj; struct dump_arg *arg; int limit; + int weak; }; static void w_long _((long, struct dump_arg*)); @@ -332,26 +333,15 @@ w_unique(s, arg) w_symbol(rb_intern(s), arg); } -static void w_object _((VALUE,struct dump_arg*,int)); +static void w_object _((VALUE,struct dump_arg*,int,int)); static int hash_each(key, value, arg) VALUE key, value; struct dump_call_arg *arg; { - w_object(key, arg->arg, arg->limit); - w_object(value, arg->arg, arg->limit); - return ST_CONTINUE; -} - -static int -obj_each(id, value, arg) - ID id; - VALUE value; - struct dump_call_arg *arg; -{ - w_symbol(id, arg->arg); - w_object(value, arg->arg, arg->limit); + w_object(key, arg->arg, arg->limit, arg->weak); + w_object(value, arg->arg, arg->limit, arg->weak); return ST_CONTINUE; } @@ -407,6 +397,17 @@ w_uclass(obj, base_klass, arg) } } +static int +w_obj_each(id, value, arg) + ID id; + VALUE value; + struct dump_call_arg *arg; +{ + w_symbol(id, arg->arg); + w_object(value, arg->arg, arg->limit, arg->weak); + return ST_CONTINUE; +} + static void w_ivar(tbl, arg) st_table *tbl; @@ -414,7 +415,7 @@ w_ivar(tbl, arg) { if (tbl) { w_long(tbl->num_entries, arg->arg); - st_foreach(tbl, obj_each, (st_data_t)arg); + st_foreach(tbl, w_obj_each, (st_data_t)arg); } else { w_long(0, arg->arg); @@ -422,10 +423,11 @@ w_ivar(tbl, arg) } static void -w_object(obj, arg, limit) +w_object(obj, arg, limit, weak) VALUE obj; struct dump_arg *arg; int limit; + int weak; { struct dump_call_arg c_arg; st_table *ivtbl = 0; @@ -437,6 +439,7 @@ w_object(obj, arg, limit) limit--; c_arg.limit = limit; c_arg.arg = arg; + c_arg.weak = Qfalse; if (ivtbl = rb_generic_ivar_table(obj)) { w_byte(TYPE_IVAR, arg); @@ -460,7 +463,7 @@ w_object(obj, arg, limit) w_long(FIX2LONG(obj), arg); } else { - w_object(rb_int2big(FIX2LONG(obj)), arg, limit); + w_object(rb_int2big(FIX2LONG(obj)), arg, limit, weak); } #endif } @@ -489,7 +492,8 @@ w_object(obj, arg, limit) v = rb_funcall(obj, s_mdump, 0, 0); w_byte(TYPE_USRMARSHAL, arg); w_unique(rb_class2name(CLASS_OF(obj)), arg); - w_object(v, arg, limit); + w_object(v, arg, limit, Qtrue); + c_arg.weak = Qtrue; if (ivtbl) w_ivar(ivtbl, &c_arg); return; } @@ -502,6 +506,7 @@ w_object(obj, arg, limit) } w_class(TYPE_USERDEF, obj, arg); w_bytes(RSTRING(v)->ptr, RSTRING(v)->len, arg); + c_arg.weak = Qtrue; if (ivtbl) w_ivar(ivtbl, &c_arg); return; } @@ -588,7 +593,7 @@ w_object(obj, arg, limit) w_long(len, arg); while (len--) { - w_object(*ptr, arg, limit); + w_object(*ptr, arg, limit, weak); ptr++; } } @@ -609,7 +614,7 @@ w_object(obj, arg, limit) w_long(RHASH(obj)->tbl->num_entries, arg); st_foreach(RHASH(obj)->tbl, hash_each, (st_data_t)&c_arg); if (!NIL_P(RHASH(obj)->ifnone)) { - w_object(RHASH(obj)->ifnone, arg, limit); + w_object(RHASH(obj)->ifnone, arg, limit, weak); } break; @@ -627,7 +632,7 @@ w_object(obj, arg, limit) } for (i=0; i<len; i++) { w_symbol(SYM2ID(RARRAY(mem)->ptr[i]), arg); - w_object(RSTRUCT(obj)->ptr[i], arg, limit); + w_object(RSTRUCT(obj)->ptr[i], arg, limit, weak); } } break; @@ -648,11 +653,15 @@ w_object(obj, arg, limit) rb_obj_classname(obj)); } v = rb_funcall(obj, s_dump_data, 0); - w_object(v, arg, limit); + w_object(v, arg, limit, weak); } break; default: + if (weak) { + w_byte(TYPE_NIL, arg); + return; + } rb_raise(rb_eTypeError, "can't dump %s", rb_obj_classname(obj)); break; @@ -667,7 +676,7 @@ static VALUE dump(arg) struct dump_call_arg *arg; { - w_object(arg->obj, arg->arg, arg->limit); + w_object(arg->obj, arg->arg, arg->limit, arg->weak); if (arg->arg->dest) { rb_io_write(arg->arg->dest, arg->arg->str); rb_str_resize(arg->arg->str, 0); @@ -2267,7 +2267,11 @@ f_optarg : f_opt } ; -f_rest_arg : tSTAR tIDENTIFIER +restarg_mark : '*' + | tSTAR + ; + +f_rest_arg : restarg_mark tIDENTIFIER { if (!is_local_id($2)) yyerror("rest argument must be local variable"); @@ -2275,13 +2279,17 @@ f_rest_arg : tSTAR tIDENTIFIER yyerror("duplicate rest argument name"); $$ = local_cnt($2); } - | tSTAR + | restarg_mark { $$ = -2; } ; -f_block_arg : tAMPER tIDENTIFIER +blkarg_mark : '&' + | tAMPER + ; + +f_block_arg : blkarg_mark tIDENTIFIER { if (!is_local_id($2)) yyerror("block argument must be local variable"); diff --git a/sample/test.rb b/sample/test.rb index 1898813564..2cf4eea1f4 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -884,6 +884,18 @@ rescue Exception end test_ok($x) +def tt4 &block + tt2(raise(ArgumentError,""),&block) +end +$x = false +begin + tt4{} +rescue ArgumentError + $x = true +rescue Exception +end +test_ok($x) + # iterator break/redo/next/retry done = true loop{ |