From f3d25fdd9c58942d5e2d909f16b1dd8adabd21e1 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 14 Aug 2003 17:20:14 +0000 Subject: [PATCH] * gc.c (id2ref): recycle check should be done by klass == 0. [ruby-core:01408] * eval.c (Init_Thread): Continuation#[] added. [ruby-talk:79028] * parse.y (mlhs_node): should allow "::Foo" (colon3) as lhs. * parse.y (lhs): ditto. * parse.y (yylex): should return tCOLON3 right after kCLASS. [ruby-talk:78918] * error.c (exc_initialize): was converting argument to string too eagerly. Only check was needed. [ruby-talk:78958] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 21 +++++++++++++++++++++ error.c | 7 ++++--- eval.c | 1 + gc.c | 2 +- lib/xmlrpc/utils.rb | 2 +- parse.y | 20 ++++++++++++++++++-- 6 files changed, 46 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6564e15b25..7e5f150eec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Aug 15 02:08:53 2003 Yukihiro Matsumoto + + * gc.c (id2ref): recycle check should be done by klass == 0. + [ruby-core:01408] + Fri Aug 15 00:38:00 2003 Shigeo Kobayashi * ext/bigdecimal/bigdecimal.c: Bug in div method fixed. @@ -6,6 +11,10 @@ Fri Aug 15 00:38:00 2003 Shigeo Kobayashi * ext/bigdecimal/sample/pi.rb: Changed so as to use math.rb. +Thu Aug 14 21:19:14 2003 Yukihiro Matsumoto + + * eval.c (Init_Thread): Continuation#[] added. [ruby-talk:79028] + Thu Aug 14 20:03:34 2003 Masaki Suketa * ext/win32ole/win32ole.c (OLE_FREE): should not call @@ -21,6 +30,18 @@ Thu Aug 14 11:27:37 2003 NAKAMURA Usaku * gc.c (rb_data_object_alloc): check type of 1st argument. [ruby-dev:21192] +Thu Aug 14 00:21:14 2003 Yukihiro Matsumoto + + * parse.y (mlhs_node): should allow "::Foo" (colon3) as lhs. + + * parse.y (lhs): ditto. + + * parse.y (yylex): should return tCOLON3 right after kCLASS. + [ruby-talk:78918] + + * error.c (exc_initialize): was converting argument to string too + eagerly. Only check was needed. [ruby-talk:78958] + Wed Aug 13 23:31:00 2003 Shigeo Kobayashi * ext/bigdecimal/bigdecimal.c .h .html: Ambiguity of diff --git a/error.c b/error.c index f8fbdf7ade..674c87d122 100644 --- a/error.c +++ b/error.c @@ -318,12 +318,13 @@ exc_initialize(argc, argv, exc) VALUE *argv; VALUE exc; { - VALUE mesg; + VALUE arg; - if (rb_scan_args(argc, argv, "01", &mesg) == 1) { + if (rb_scan_args(argc, argv, "01", &arg) == 1) { + VALUE mesg = arg; StringValue(mesg); /* ensure mesg can be converted to String */ } - rb_iv_set(exc, "mesg", mesg); + rb_iv_set(exc, "mesg", arg); rb_iv_set(exc, "bt", Qnil); return exc; diff --git a/eval.c b/eval.c index a03c676068..986eb197ac 100644 --- a/eval.c +++ b/eval.c @@ -10114,6 +10114,7 @@ Init_Thread() rb_undef_alloc_func(rb_cCont); rb_undef_method(CLASS_OF(rb_cCont), "new"); rb_define_method(rb_cCont, "call", rb_cont_call, -1); + rb_define_method(rb_cCont, "[]", rb_cont_call, -1); rb_define_global_function("callcc", rb_callcc, 0); cThGroup = rb_define_class("ThreadGroup", rb_cObject); diff --git a/gc.c b/gc.c index a76d5c81bc..1024c1a50e 100644 --- a/gc.c +++ b/gc.c @@ -1639,7 +1639,7 @@ id2ref(obj, id) if (!is_pointer_to_heap((void *)ptr)) { rb_raise(rb_eRangeError, "0x%lx is not id value", p0); } - if (BUILTIN_TYPE(ptr) == 0) { + if (RBASIC(ptr)->klass == 0) { rb_raise(rb_eRangeError, "0x%lx is recycled object", p0); } return (VALUE)ptr; diff --git a/lib/xmlrpc/utils.rb b/lib/xmlrpc/utils.rb index 675f23275b..14dd08b21d 100644 --- a/lib/xmlrpc/utils.rb +++ b/lib/xmlrpc/utils.rb @@ -113,7 +113,7 @@ module XMLRPC def initialize(prefix, &p) raise "No interface specified" if p.nil? super(prefix) - instance_eval &p + instance_eval(&p) end def get_methods(obj, delim=".") diff --git a/parse.y b/parse.y index c037fcb772..32f843cee9 100644 --- a/parse.y +++ b/parse.y @@ -809,6 +809,12 @@ mlhs_node : variable yyerror("dynamic constant assignment"); $$ = NEW_CDECL(0, 0, NEW_COLON2($1, $3)); } + | tCOLON3 tCONSTANT + { + if (in_def || in_single) + yyerror("dynamic constant assignment"); + $$ = NEW_CDECL(0, 0, NEW_COLON3($2)); + } | backref { rb_backref_error($1); @@ -842,6 +848,12 @@ lhs : variable yyerror("dynamic constant assignment"); $$ = NEW_CDECL(0, 0, NEW_COLON2($1, $3)); } + | tCOLON3 tCONSTANT + { + if (in_def || in_single) + yyerror("dynamic constant assignment"); + $$ = NEW_CDECL(0, 0, NEW_COLON3($2)); + } | backref { rb_backref_error($1); @@ -1026,6 +1038,10 @@ arg : lhs '=' arg { yyerror("constant re-assignment"); } + | tCOLON3 tCONSTANT tOP_ASGN arg + { + yyerror("constant re-assignment"); + } | backref tOP_ASGN arg { rb_backref_error($1); @@ -1431,7 +1447,7 @@ primary : literal { $$ = NEW_COLON2($1, $3); } - | tCOLON3 cname + | tCOLON3 tCONSTANT { $$ = NEW_COLON3($2); } @@ -3928,7 +3944,7 @@ yylex() c = nextc(); if (c == ':') { if (lex_state == EXPR_BEG || lex_state == EXPR_MID || - (IS_ARG() && space_seen)) { + lex_state == EXPR_CLASS || (IS_ARG() && space_seen)) { lex_state = EXPR_BEG; return tCOLON3; }