* class.c (rb_define_method): do not set NOEX_CFUNC if klass is
really a module, whose methods must be safe for reciever's type. * eval.c (rb_eval): nosuper should not be inherited unless the overwritten method is an undef placeholder. * parse.y (primary): allow 'when'-less case statement; persuaded by Sean Chittenden. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8e3721dfa8
commit
54fdacb125
13
ChangeLog
13
ChangeLog
@ -6,6 +6,14 @@ Thu Nov 7 09:51:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
|||||||
* eval.c (blk_orphan): a block created in a different thread is
|
* eval.c (blk_orphan): a block created in a different thread is
|
||||||
orphan. [ruby-dev:17471]
|
orphan. [ruby-dev:17471]
|
||||||
|
|
||||||
|
Wed Nov 6 16:57:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* class.c (rb_define_method): do not set NOEX_CFUNC if klass is
|
||||||
|
really a module, whose methods must be safe for reciever's type.
|
||||||
|
|
||||||
|
* eval.c (rb_eval): nosuper should not be inherited unless the
|
||||||
|
overwritten method is an undef placeholder.
|
||||||
|
|
||||||
Tue Nov 5 00:46:04 2002 Akinori MUSHA <knu@iDaemons.org>
|
Tue Nov 5 00:46:04 2002 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* ext/extmk.rb: Properly pass the given target to
|
* ext/extmk.rb: Properly pass the given target to
|
||||||
@ -16,6 +24,11 @@ Mon Nov 4 20:03:53 2002 NAKAMURA Usaku <usa@ruby-lang.org>
|
|||||||
* instruby.rb, lib/mkmf.rb: use CONFIG["ENABLE_SHARED"] instead of
|
* instruby.rb, lib/mkmf.rb: use CONFIG["ENABLE_SHARED"] instead of
|
||||||
checking whether CONFIG["configure-args"] includes "--enable-shared".
|
checking whether CONFIG["configure-args"] includes "--enable-shared".
|
||||||
|
|
||||||
|
Mon Nov 4 16:49:14 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (primary): allow 'when'-less case statement; persuaded
|
||||||
|
by Sean Chittenden.
|
||||||
|
|
||||||
Mon Nov 4 06:28:09 2002 Akinori MUSHA <knu@iDaemons.org>
|
Mon Nov 4 06:28:09 2002 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* Makefile.in, ext/extmk.rb, bcc32/Makefile.sub,
|
* Makefile.in, ext/extmk.rb, bcc32/Makefile.sub,
|
||||||
|
9
class.c
9
class.c
@ -684,10 +684,13 @@ rb_define_method(klass, name, func, argc)
|
|||||||
int argc;
|
int argc;
|
||||||
{
|
{
|
||||||
ID id = rb_intern(name);
|
ID id = rb_intern(name);
|
||||||
|
int ex = NOEX_PUBLIC;
|
||||||
|
|
||||||
rb_add_method(klass, id, NEW_CFUNC(func, argc),
|
|
||||||
((name[0] == 'i' && id == rb_intern("initialize"))?
|
if (BUILTIN_TYPE(klass) == T_CLASS) {
|
||||||
NOEX_PRIVATE:NOEX_PUBLIC)|NOEX_CFUNC);
|
ex |= NOEX_CFUNC;
|
||||||
|
}
|
||||||
|
rb_add_method(klass, id, NEW_CFUNC(func, argc), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
10
eval.c
10
eval.c
@ -384,7 +384,7 @@ rb_disable_super(klass, name)
|
|||||||
print_undef(klass, mid);
|
print_undef(klass, mid);
|
||||||
}
|
}
|
||||||
if (origin == klass) {
|
if (origin == klass) {
|
||||||
body->nd_noex |= NOEX_UNDEF;
|
body->nd_noex |= NOEX_NOSUPER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_add_method(klass, mid, 0, NOEX_UNDEF);
|
rb_add_method(klass, mid, 0, NOEX_UNDEF);
|
||||||
@ -408,7 +408,7 @@ rb_enable_super(klass, name)
|
|||||||
remove_method(klass, mid);
|
remove_method(klass, mid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
body->nd_noex &= ~NOEX_UNDEF;
|
body->nd_noex &= ~NOEX_NOSUPER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3204,8 +3204,8 @@ rb_eval(self, n)
|
|||||||
else {
|
else {
|
||||||
noex = NOEX_PUBLIC;
|
noex = NOEX_PUBLIC;
|
||||||
}
|
}
|
||||||
if (body && origin == ruby_class && body->nd_noex & NOEX_UNDEF) {
|
if (body && origin == ruby_class && body->nd_body == 0) {
|
||||||
noex |= NOEX_UNDEF;
|
noex |= NOEX_NOSUPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
defn = copy_node_scope(node->nd_defn, ruby_cref);
|
defn = copy_node_scope(node->nd_defn, ruby_cref);
|
||||||
@ -4807,7 +4807,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rb_call0(klass, recv, mid, id, argc, argv, body, noex & NOEX_UNDEF);
|
return rb_call0(klass, recv, mid, id, argc, argv, body, noex & NOEX_NOSUPER);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
@ -52,17 +52,17 @@ module Finalizer
|
|||||||
ObjectSpace.call_finalizer(obj)
|
ObjectSpace.call_finalizer(obj)
|
||||||
method = method.intern unless method.kind_of?(Integer)
|
method = method.intern unless method.kind_of?(Integer)
|
||||||
assoc = [dependant, method].concat(opt)
|
assoc = [dependant, method].concat(opt)
|
||||||
if dep = @dependency[obj.id]
|
if dep = @dependency[obj.object_id]
|
||||||
dep.push assoc
|
dep.push assoc
|
||||||
else
|
else
|
||||||
@dependency[obj.id] = [assoc]
|
@dependency[obj.object_id] = [assoc]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias add add_dependency
|
alias add add_dependency
|
||||||
|
|
||||||
# delete dependency R_method(obj, dependant)
|
# delete dependency R_method(obj, dependant)
|
||||||
def delete_dependency(id, dependant, method = :finalize)
|
def delete_dependency(id, dependant, method = :finalize)
|
||||||
id = id.id unless id.kind_of?(Integer)
|
id = id.object_id unless id.kind_of?(Integer)
|
||||||
method = method.intern unless method.kind_of?(Integer)
|
method = method.intern unless method.kind_of?(Integer)
|
||||||
for assoc in @dependency[id]
|
for assoc in @dependency[id]
|
||||||
assoc.delete_if do
|
assoc.delete_if do
|
||||||
@ -76,7 +76,7 @@ module Finalizer
|
|||||||
|
|
||||||
# delete dependency R_*(obj, dependant)
|
# delete dependency R_*(obj, dependant)
|
||||||
def delete_all_dependency(id, dependant)
|
def delete_all_dependency(id, dependant)
|
||||||
id = id.id unless id.kind_of?(Integer)
|
id = id.object_id unless id.kind_of?(Integer)
|
||||||
method = method.intern unless method.kind_of?(Integer)
|
method = method.intern unless method.kind_of?(Integer)
|
||||||
for assoc in @dependency[id]
|
for assoc in @dependency[id]
|
||||||
assoc.delete_if do
|
assoc.delete_if do
|
||||||
@ -104,7 +104,7 @@ module Finalizer
|
|||||||
|
|
||||||
# finalize the depandant connected by dependency R_method(obj, dependtant)
|
# finalize the depandant connected by dependency R_method(obj, dependtant)
|
||||||
def finalize_dependency(id, dependant, method = :finalize)
|
def finalize_dependency(id, dependant, method = :finalize)
|
||||||
id = id.id unless id.kind_of?(Integer)
|
id = id.object_id unless id.kind_of?(Integer)
|
||||||
method = method.intern unless method.kind_of?(Integer)
|
method = method.intern unless method.kind_of?(Integer)
|
||||||
for assocs in @dependency[id]
|
for assocs in @dependency[id]
|
||||||
assocs.delete_if do
|
assocs.delete_if do
|
||||||
@ -119,7 +119,7 @@ module Finalizer
|
|||||||
|
|
||||||
# finalize all dependants connected by dependency R_*(obj, dependtant)
|
# finalize all dependants connected by dependency R_*(obj, dependtant)
|
||||||
def finalize_all_dependency(id, dependant)
|
def finalize_all_dependency(id, dependant)
|
||||||
id = id.id unless id.kind_of?(Integer)
|
id = id.object_id unless id.kind_of?(Integer)
|
||||||
method = method.intern unless method.kind_of?(Integer)
|
method = method.intern unless method.kind_of?(Integer)
|
||||||
for assoc in @dependency[id]
|
for assoc in @dependency[id]
|
||||||
assoc.delete_if do
|
assoc.delete_if do
|
||||||
|
@ -265,7 +265,7 @@ class Set
|
|||||||
def flatten_merge(set, seen = Set.new)
|
def flatten_merge(set, seen = Set.new)
|
||||||
set.each { |e|
|
set.each { |e|
|
||||||
if e.is_a?(Set)
|
if e.is_a?(Set)
|
||||||
if seen.include?(e_id = e.id)
|
if seen.include?(e_id = e.object_id)
|
||||||
raise ArgumentError, "tried to flatten recursive Set"
|
raise ArgumentError, "tried to flatten recursive Set"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ class Tracer
|
|||||||
def initialize
|
def initialize
|
||||||
@threads = Hash.new
|
@threads = Hash.new
|
||||||
if defined? Thread.main
|
if defined? Thread.main
|
||||||
@threads[Thread.main.id] = 0
|
@threads[Thread.main.object_id] = 0
|
||||||
else
|
else
|
||||||
@threads[Thread.current.id] = 0
|
@threads[Thread.current.object_id] = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@get_line_procs = {}
|
@get_line_procs = {}
|
||||||
@ -105,10 +105,10 @@ class Tracer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_thread_no
|
def get_thread_no
|
||||||
if no = @threads[Thread.current.id]
|
if no = @threads[Thread.current.object_id]
|
||||||
no
|
no
|
||||||
else
|
else
|
||||||
@threads[Thread.current.id] = @threads.size
|
@threads[Thread.current.object_id] = @threads.size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1130,7 +1130,7 @@ Object
|
|||||||
=begin
|
=begin
|
||||||
=end
|
=end
|
||||||
def inspect
|
def inspect
|
||||||
sprintf("#<%s:0x%x URL:%s>", self.class.to_s, self.id, self.to_s)
|
sprintf("#<%s:0x%x URL:%s>", self.class.to_s, self.object_id, self.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
6
node.h
6
node.h
@ -334,12 +334,14 @@ typedef struct RNode {
|
|||||||
#define NEW_BMETHOD(b) rb_node_newnode(NODE_BMETHOD,0,0,b)
|
#define NEW_BMETHOD(b) rb_node_newnode(NODE_BMETHOD,0,0,b)
|
||||||
|
|
||||||
#define NOEX_PUBLIC 0
|
#define NOEX_PUBLIC 0
|
||||||
#define NOEX_UNDEF 1
|
#define NOEX_NOSUPER 1
|
||||||
#define NOEX_CFUNC 1
|
|
||||||
#define NOEX_PRIVATE 2
|
#define NOEX_PRIVATE 2
|
||||||
#define NOEX_PROTECTED 4
|
#define NOEX_PROTECTED 4
|
||||||
#define NOEX_MASK 6
|
#define NOEX_MASK 6
|
||||||
|
|
||||||
|
#define NOEX_UNDEF NOEX_NOSUPER
|
||||||
|
#define NOEX_CFUNC NOEX_NOSUPER
|
||||||
|
|
||||||
NODE *rb_compile_cstr _((const char*, const char*, int, int));
|
NODE *rb_compile_cstr _((const char*, const char*, int, int));
|
||||||
NODE *rb_compile_string _((const char*, VALUE, int));
|
NODE *rb_compile_string _((const char*, VALUE, int));
|
||||||
NODE *rb_compile_file _((const char*, VALUE, int));
|
NODE *rb_compile_file _((const char*, VALUE, int));
|
||||||
|
8
parse.y
8
parse.y
@ -485,6 +485,10 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
|||||||
$$ = 0;
|
$$ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| expr kRESCUE_MOD expr
|
||||||
|
{
|
||||||
|
$$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0);
|
||||||
|
}
|
||||||
| primary_value '[' aref_args ']' tOP_ASGN command_call
|
| primary_value '[' aref_args ']' tOP_ASGN command_call
|
||||||
{
|
{
|
||||||
NODE *args;
|
NODE *args;
|
||||||
@ -1417,6 +1421,10 @@ primary : literal
|
|||||||
{
|
{
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
}
|
}
|
||||||
|
| kCASE opt_terms kELSE compstmt kEND
|
||||||
|
{
|
||||||
|
$$ = $4;
|
||||||
|
}
|
||||||
| kFOR block_var kIN {COND_PUSH(1);} expr_value do {COND_POP();}
|
| kFOR block_var kIN {COND_PUSH(1);} expr_value do {COND_POP();}
|
||||||
compstmt
|
compstmt
|
||||||
kEND
|
kEND
|
||||||
|
Loading…
x
Reference in New Issue
Block a user