зеркало из https://github.com/github/ruby.git
* class.c (ins_methods_i): should not show ID_ALLOCATOR.
* class.c (ins_methods_prot_i): ditto. * class.c (ins_methods_priv_i): ditto. * class.c (ins_methods_pub_i): ditto. * eval.c (call_trace_func): ditto. * eval.c (rb_undefined): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
2b334012fc
Коммит
e274c3ab76
14
ChangeLog
14
ChangeLog
|
@ -27,6 +27,20 @@ Sun Dec 22 00:36:43 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
|||
|
||||
* lib/mkmf.rb (create_makefile): accept pure ruby libraries.
|
||||
|
||||
Sat Dec 21 23:59:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* class.c (ins_methods_i): should not show ID_ALLOCATOR.
|
||||
|
||||
* class.c (ins_methods_prot_i): ditto.
|
||||
|
||||
* class.c (ins_methods_priv_i): ditto.
|
||||
|
||||
* class.c (ins_methods_pub_i): ditto.
|
||||
|
||||
* eval.c (call_trace_func): ditto.
|
||||
|
||||
* eval.c (rb_undefined): ditto.
|
||||
|
||||
Sat Dec 21 07:27:24 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* misc/ruby-mode.el (ruby-parse-partial): keywords must not be
|
||||
|
|
1
MANIFEST
1
MANIFEST
|
@ -197,6 +197,7 @@ lib/ping.rb
|
|||
lib/pp.rb
|
||||
lib/prettyprint.rb
|
||||
lib/profile.rb
|
||||
lib/profiler.rb
|
||||
lib/pstore.rb
|
||||
lib/racc/parser.rb
|
||||
lib/rational.rb
|
||||
|
|
4
class.c
4
class.c
|
@ -459,6 +459,7 @@ ins_methods_i(key, body, ary)
|
|||
NODE *body;
|
||||
VALUE ary;
|
||||
{
|
||||
if (key == ID_ALLOCATOR) return ST_CONTINUE;
|
||||
if (!body->nd_body) {
|
||||
rb_ary_push(ary, Qnil);
|
||||
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
|
||||
|
@ -483,6 +484,7 @@ ins_methods_prot_i(key, body, ary)
|
|||
NODE *body;
|
||||
VALUE ary;
|
||||
{
|
||||
if (key == ID_ALLOCATOR) return ST_CONTINUE;
|
||||
if (!body->nd_body) {
|
||||
rb_ary_push(ary, Qnil);
|
||||
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
|
||||
|
@ -507,6 +509,7 @@ ins_methods_priv_i(key, body, ary)
|
|||
NODE *body;
|
||||
VALUE ary;
|
||||
{
|
||||
if (key == ID_ALLOCATOR) return ST_CONTINUE;
|
||||
if (!body->nd_body) {
|
||||
rb_ary_push(ary, Qnil);
|
||||
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
|
||||
|
@ -531,6 +534,7 @@ ins_methods_pub_i(key, body, ary)
|
|||
NODE *body;
|
||||
VALUE ary;
|
||||
{
|
||||
if (key == ID_ALLOCATOR) return ST_CONTINUE;
|
||||
if (!body->nd_body) {
|
||||
rb_ary_push(ary, Qnil);
|
||||
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
|
||||
|
|
17
eval.c
17
eval.c
|
@ -230,7 +230,7 @@ rb_clear_cache_by_class(klass)
|
|||
}
|
||||
}
|
||||
|
||||
static ID init, alloc, eqq, each, aref, aset, match, missing;
|
||||
static ID init, eqq, each, aref, aset, match, missing;
|
||||
static ID added, singleton_added;
|
||||
static ID __id__, __send__;
|
||||
|
||||
|
@ -247,10 +247,13 @@ rb_add_method(klass, mid, node, noex)
|
|||
if (ruby_safe_level >= 4 && (klass == rb_cObject || !OBJ_TAINTED(klass))) {
|
||||
rb_raise(rb_eSecurityError, "Insecure: can't define method");
|
||||
}
|
||||
if (mid == init && !FL_TEST(klass, FL_SINGLETON) && node && nd_type(node) != NODE_ZSUPER) {
|
||||
if (!FL_TEST(klass, FL_SINGLETON) &&
|
||||
node && nd_type(node) != NODE_ZSUPER &&
|
||||
mid == rb_intern("initialize")) {
|
||||
noex = NOEX_PRIVATE | (noex & NOEX_NOSUPER);
|
||||
}
|
||||
else if (mid == alloc && FL_TEST(klass, FL_SINGLETON) && node && nd_type(node) == NODE_CFUNC) {
|
||||
else if (FL_TEST(klass, FL_SINGLETON) && node && nd_type(node) == NODE_CFUNC &&
|
||||
mid == rb_intern("allocate")) {
|
||||
rb_warn("defining %s.allocate is deprecated; use rb_define_alloc_func()",
|
||||
rb_class2name(rb_iv_get(klass, "__attached__")));
|
||||
mid = ID_ALLOCATOR;
|
||||
|
@ -2105,6 +2108,7 @@ call_trace_func(event, node, self, id, klass)
|
|||
if (!trace_func) return;
|
||||
if (tracing) return;
|
||||
if (ruby_in_compile) return;
|
||||
if (id == ID_ALLOCATOR) return;
|
||||
|
||||
node_save[0] = ruby_last_node;
|
||||
if (!(node_save[1] = ruby_current_node)) {
|
||||
|
@ -4408,7 +4412,7 @@ rb_f_missing(argc, argv, obj)
|
|||
if (last_call_status & CSTAT_PRIV) {
|
||||
format = "private method `%s' called for %s%s%s";
|
||||
}
|
||||
if (last_call_status & CSTAT_PROT) {
|
||||
else if (last_call_status & CSTAT_PROT) {
|
||||
format = "protected method `%s' called for %s%s%s";
|
||||
}
|
||||
else if (last_call_status & CSTAT_VCALL) {
|
||||
|
@ -4460,6 +4464,9 @@ rb_undefined(obj, id, argc, argv, call_status)
|
|||
rb_f_missing(argc, argv, obj);
|
||||
POP_FRAME();
|
||||
}
|
||||
else if (id == ID_ALLOCATOR) {
|
||||
rb_fatal("allocator undefined for %s", rb_class2name(obj));
|
||||
}
|
||||
|
||||
nargv = ALLOCA_N(VALUE, argc+1);
|
||||
nargv[0] = ID2SYM(id);
|
||||
|
@ -4608,7 +4615,6 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
|
|||
if (trace_func) {
|
||||
int state;
|
||||
|
||||
if (id == ID_ALLOCATOR) id = alloc;
|
||||
call_trace_func("c-call", ruby_current_node, recv, id, klass);
|
||||
PUSH_TAG(PROT_FUNC);
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
|
@ -6160,7 +6166,6 @@ void
|
|||
Init_eval()
|
||||
{
|
||||
init = rb_intern("initialize");
|
||||
alloc = rb_intern("allocate");
|
||||
eqq = rb_intern("===");
|
||||
each = rb_intern("each");
|
||||
|
||||
|
|
2
intern.h
2
intern.h
|
@ -17,7 +17,7 @@
|
|||
* the kernel.
|
||||
*/
|
||||
|
||||
#define ID_ALLOCATOR 1
|
||||
#define ID_ALLOCATOR 0
|
||||
|
||||
/* array.c */
|
||||
void rb_mem_clear _((register VALUE*, register long));
|
||||
|
|
|
@ -122,7 +122,7 @@ module IRB
|
|||
|
||||
gv = eval "global_variables", bind
|
||||
lv = eval "local_variables", bind
|
||||
cv = eval "type.constants", bind
|
||||
cv = eval "self.type.constants", bind
|
||||
|
||||
if (gv | lv | cv).include?(receiver)
|
||||
# foo.func and foo is local var.
|
||||
|
|
Загрузка…
Ссылка в новой задаче