mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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. * lib/irb/ruby-lex.rb (RubyLex::identify_identifier): support 'class ::Foo' syntax. [ruby-talk:83514] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28af5f6cf5
commit
415283ac95
7 changed files with 80 additions and 29 deletions
22
ChangeLog
22
ChangeLog
|
@ -30,6 +30,23 @@ Sat Oct 4 17:52:59 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||||
|
|
||||||
* test/runner.rb: give testsuite name.
|
* test/runner.rb: give testsuite name.
|
||||||
|
|
||||||
|
Sat Oct 4 15:16:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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 <akr@m17n.org>
|
Sat Oct 4 14:59:51 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* lib/pathname.rb (initialize): raise ArgumentError if argument has
|
* lib/pathname.rb (initialize): raise ArgumentError if argument has
|
||||||
|
@ -123,6 +140,11 @@ Fri Oct 3 13:02:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
|
||||||
|
|
||||||
* test/testunit/collector/test_objectspace.rb: ditto.
|
* test/testunit/collector/test_objectspace.rb: ditto.
|
||||||
|
|
||||||
|
Fri Oct 3 08:14:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/irb/ruby-lex.rb (RubyLex::identify_identifier): support
|
||||||
|
'class ::Foo' syntax. [ruby-talk:83514]
|
||||||
|
|
||||||
Fri Oct 3 08:01:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
|
Fri Oct 3 08:01:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
|
||||||
|
|
||||||
* lib/test/unit/assertions.rb: added a default message for #assert,
|
* lib/test/unit/assertions.rb: added a default message for #assert,
|
||||||
|
|
2
eval.c
2
eval.c
|
@ -2828,7 +2828,7 @@ rb_eval(self, n)
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
if (state) JUMP_TAG(state);
|
if (state) JUMP_TAG(state);
|
||||||
/* no exception raised */
|
/* no exception raised */
|
||||||
if (node = node->nd_else) { /* else clause given */
|
if (!rescuing && (node = node->nd_else)) { /* else clause given */
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -788,6 +788,7 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* use original value */
|
/* use original value */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
asn1data = rb_funcall(klass, rb_intern("new"), 1, value);
|
asn1data = rb_funcall(klass, rb_intern("new"), 1, value);
|
||||||
|
|
|
@ -791,8 +791,7 @@ class RubyLex
|
||||||
valid = true
|
valid = true
|
||||||
case token
|
case token
|
||||||
when "class"
|
when "class"
|
||||||
valid = false unless peek_match?(/^\s*(<<|\w)/)
|
valid = false unless peek_match?(/^\s*(<<|\w|::)/)
|
||||||
|
|
||||||
when "def"
|
when "def"
|
||||||
valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
|
valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
|
||||||
# valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)?=|\&\&|\|\|)/)
|
# valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)?=|\&\&|\|\|)/)
|
||||||
|
|
55
marshal.c
55
marshal.c
|
@ -93,6 +93,7 @@ struct dump_call_arg {
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
struct dump_arg *arg;
|
struct dump_arg *arg;
|
||||||
int limit;
|
int limit;
|
||||||
|
int weak;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void w_long _((long, struct dump_arg*));
|
static void w_long _((long, struct dump_arg*));
|
||||||
|
@ -332,26 +333,15 @@ w_unique(s, arg)
|
||||||
w_symbol(rb_intern(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
|
static int
|
||||||
hash_each(key, value, arg)
|
hash_each(key, value, arg)
|
||||||
VALUE key, value;
|
VALUE key, value;
|
||||||
struct dump_call_arg *arg;
|
struct dump_call_arg *arg;
|
||||||
{
|
{
|
||||||
w_object(key, arg->arg, arg->limit);
|
w_object(key, arg->arg, arg->limit, arg->weak);
|
||||||
w_object(value, arg->arg, arg->limit);
|
w_object(value, arg->arg, arg->limit, arg->weak);
|
||||||
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);
|
|
||||||
return ST_CONTINUE;
|
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
|
static void
|
||||||
w_ivar(tbl, arg)
|
w_ivar(tbl, arg)
|
||||||
st_table *tbl;
|
st_table *tbl;
|
||||||
|
@ -414,7 +415,7 @@ w_ivar(tbl, arg)
|
||||||
{
|
{
|
||||||
if (tbl) {
|
if (tbl) {
|
||||||
w_long(tbl->num_entries, arg->arg);
|
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 {
|
else {
|
||||||
w_long(0, arg->arg);
|
w_long(0, arg->arg);
|
||||||
|
@ -422,10 +423,11 @@ w_ivar(tbl, arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
w_object(obj, arg, limit)
|
w_object(obj, arg, limit, weak)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
struct dump_arg *arg;
|
struct dump_arg *arg;
|
||||||
int limit;
|
int limit;
|
||||||
|
int weak;
|
||||||
{
|
{
|
||||||
struct dump_call_arg c_arg;
|
struct dump_call_arg c_arg;
|
||||||
st_table *ivtbl = 0;
|
st_table *ivtbl = 0;
|
||||||
|
@ -437,6 +439,7 @@ w_object(obj, arg, limit)
|
||||||
limit--;
|
limit--;
|
||||||
c_arg.limit = limit;
|
c_arg.limit = limit;
|
||||||
c_arg.arg = arg;
|
c_arg.arg = arg;
|
||||||
|
c_arg.weak = Qfalse;
|
||||||
|
|
||||||
if (ivtbl = rb_generic_ivar_table(obj)) {
|
if (ivtbl = rb_generic_ivar_table(obj)) {
|
||||||
w_byte(TYPE_IVAR, arg);
|
w_byte(TYPE_IVAR, arg);
|
||||||
|
@ -460,7 +463,7 @@ w_object(obj, arg, limit)
|
||||||
w_long(FIX2LONG(obj), arg);
|
w_long(FIX2LONG(obj), arg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
w_object(rb_int2big(FIX2LONG(obj)), arg, limit);
|
w_object(rb_int2big(FIX2LONG(obj)), arg, limit, weak);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -489,7 +492,8 @@ w_object(obj, arg, limit)
|
||||||
v = rb_funcall(obj, s_mdump, 0, 0);
|
v = rb_funcall(obj, s_mdump, 0, 0);
|
||||||
w_byte(TYPE_USRMARSHAL, arg);
|
w_byte(TYPE_USRMARSHAL, arg);
|
||||||
w_unique(rb_class2name(CLASS_OF(obj)), 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);
|
if (ivtbl) w_ivar(ivtbl, &c_arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -502,6 +506,7 @@ w_object(obj, arg, limit)
|
||||||
}
|
}
|
||||||
w_class(TYPE_USERDEF, obj, arg);
|
w_class(TYPE_USERDEF, obj, arg);
|
||||||
w_bytes(RSTRING(v)->ptr, RSTRING(v)->len, arg);
|
w_bytes(RSTRING(v)->ptr, RSTRING(v)->len, arg);
|
||||||
|
c_arg.weak = Qtrue;
|
||||||
if (ivtbl) w_ivar(ivtbl, &c_arg);
|
if (ivtbl) w_ivar(ivtbl, &c_arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -588,7 +593,7 @@ w_object(obj, arg, limit)
|
||||||
|
|
||||||
w_long(len, arg);
|
w_long(len, arg);
|
||||||
while (len--) {
|
while (len--) {
|
||||||
w_object(*ptr, arg, limit);
|
w_object(*ptr, arg, limit, weak);
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +614,7 @@ w_object(obj, arg, limit)
|
||||||
w_long(RHASH(obj)->tbl->num_entries, arg);
|
w_long(RHASH(obj)->tbl->num_entries, arg);
|
||||||
st_foreach(RHASH(obj)->tbl, hash_each, (st_data_t)&c_arg);
|
st_foreach(RHASH(obj)->tbl, hash_each, (st_data_t)&c_arg);
|
||||||
if (!NIL_P(RHASH(obj)->ifnone)) {
|
if (!NIL_P(RHASH(obj)->ifnone)) {
|
||||||
w_object(RHASH(obj)->ifnone, arg, limit);
|
w_object(RHASH(obj)->ifnone, arg, limit, weak);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -627,7 +632,7 @@ w_object(obj, arg, limit)
|
||||||
}
|
}
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
w_symbol(SYM2ID(RARRAY(mem)->ptr[i]), arg);
|
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;
|
break;
|
||||||
|
@ -648,11 +653,15 @@ w_object(obj, arg, limit)
|
||||||
rb_obj_classname(obj));
|
rb_obj_classname(obj));
|
||||||
}
|
}
|
||||||
v = rb_funcall(obj, s_dump_data, 0);
|
v = rb_funcall(obj, s_dump_data, 0);
|
||||||
w_object(v, arg, limit);
|
w_object(v, arg, limit, weak);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (weak) {
|
||||||
|
w_byte(TYPE_NIL, arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
rb_raise(rb_eTypeError, "can't dump %s",
|
rb_raise(rb_eTypeError, "can't dump %s",
|
||||||
rb_obj_classname(obj));
|
rb_obj_classname(obj));
|
||||||
break;
|
break;
|
||||||
|
@ -667,7 +676,7 @@ static VALUE
|
||||||
dump(arg)
|
dump(arg)
|
||||||
struct dump_call_arg *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) {
|
if (arg->arg->dest) {
|
||||||
rb_io_write(arg->arg->dest, arg->arg->str);
|
rb_io_write(arg->arg->dest, arg->arg->str);
|
||||||
rb_str_resize(arg->arg->str, 0);
|
rb_str_resize(arg->arg->str, 0);
|
||||||
|
|
14
parse.y
14
parse.y
|
@ -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))
|
if (!is_local_id($2))
|
||||||
yyerror("rest argument must be local variable");
|
yyerror("rest argument must be local variable");
|
||||||
|
@ -2275,13 +2279,17 @@ f_rest_arg : tSTAR tIDENTIFIER
|
||||||
yyerror("duplicate rest argument name");
|
yyerror("duplicate rest argument name");
|
||||||
$$ = local_cnt($2);
|
$$ = local_cnt($2);
|
||||||
}
|
}
|
||||||
| tSTAR
|
| restarg_mark
|
||||||
{
|
{
|
||||||
$$ = -2;
|
$$ = -2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
f_block_arg : tAMPER tIDENTIFIER
|
blkarg_mark : '&'
|
||||||
|
| tAMPER
|
||||||
|
;
|
||||||
|
|
||||||
|
f_block_arg : blkarg_mark tIDENTIFIER
|
||||||
{
|
{
|
||||||
if (!is_local_id($2))
|
if (!is_local_id($2))
|
||||||
yyerror("block argument must be local variable");
|
yyerror("block argument must be local variable");
|
||||||
|
|
|
@ -884,6 +884,18 @@ rescue Exception
|
||||||
end
|
end
|
||||||
test_ok($x)
|
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
|
# iterator break/redo/next/retry
|
||||||
done = true
|
done = true
|
||||||
loop{
|
loop{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue