[#9445] thread.rb — m_seki@...

18 messages 2000/03/16
[#9446] Re: thread.rb — matz@... (Yukihiro Matsumoto) 2000/03/17

[#9460] Re: thread.rb — m_seki@... 2000/03/21

[#9462] Re: thread.rb — matz@... (Yukihiro Matsumoto) 2000/03/21

まつもと ゆきひろです

[#11281] Re: thread.rb — Masatoshi SEKI <m_seki@...> 2000/10/22

[#9498] timeout しない timeout — ARIMA Yasuhiro <fit0298@...>

有馬です。

20 messages 2000/03/26
[#9506] Re: timeout しない timeout — matz@... (Yukihiro Matsumoto) 2000/03/27

まつもと ゆきひろです

[#9509] Re: timeout しない timeout — gotoken@... (GOTO Kentaro) 2000/03/27

In message "[ruby-dev:9506] Re: timeout しない timeout"

[ruby-dev:9450] method_added

From: nobu.nakada@...
Date: 2000-03-18 03:52:06 UTC
List: ruby-dev #9450
なかだです。

  attr や module_function のときには method_added が呼ばれないの
は意図的なものでしょうか。それと method_added の引数が Symbol じゃ
なくて Fixnum のままなのもわざと?


Sat Mar 18 12:36:09 2000  Nobuyoshi Nakada  <nobu.nokada@softhome.net>

	* eval.c (rb_backtrace, make_backtrace): removed unsed variable
	  `lev'.

	* eval.c (rb_attr): calls `method_added' at attribute definition.

	* eval.c (rb_mod_modfunc): calls `singleton_method_added' while
	  `module_function'.

	* eval.c (rb_eval): parameter to `method_added' and
	  `singleton_method_added' is Symbol.

	* eval.c (Init_eval): caches IDs for `method_added' and
	  `singleton_method_added'.


--- .../eval.c	Fri Mar 17 23:19:12 2000
+++ eval.c	Sat Mar 18 12:36:40 2000
@@ -421,4 +421,6 @@ rb_method_boundp(klass, id, ex)
 }
 
+static ID init, eqq, each, aref, aset, match, missing, added, singleton_added;
+
 void
 rb_attr(klass, id, read, write, ex)
@@ -455,4 +457,5 @@ rb_attr(klass, id, read, write, ex)
     if (read) {
 	rb_add_method(klass, id, NEW_IVAR(attriv), noex);
+	rb_funcall(klass, added, 1, ID2SYM(id));
     }
     sprintf(buf, "%s=", name);
@@ -460,8 +463,8 @@ rb_attr(klass, id, read, write, ex)
     if (write) {
 	rb_add_method(klass, id, NEW_ATTRSET(attriv), noex);
+	rb_funcall(klass, added, 1, ID2SYM(id));
     }
 }
 
-static ID init, eqq, each, aref, aset, match, missing;
 VALUE ruby_errinfo = Qnil;
 extern NODE *ruby_eval_tree_begin;
@@ -2761,15 +2764,12 @@ rb_eval(self, node)
 		rb_add_method(rb_singleton_class(ruby_class),
 			      node->nd_mid, node->nd_defn, NOEX_PUBLIC);
-		rb_funcall(ruby_class, rb_intern("singleton_method_added"),
-			   1, INT2FIX(node->nd_mid));
+		rb_funcall(ruby_class, singleton_added, 1, ID2SYM(node->nd_mid));
 	    }
 	    if (FL_TEST(ruby_class, FL_SINGLETON)) {
 		rb_funcall(rb_iv_get(ruby_class, "__attached__"),
-			   rb_intern("singleton_method_added"),
-			   1, INT2FIX(node->nd_mid));
+			   singleton_added, 1, ID2SYM(node->nd_mid));
 	    }
 	    else {
-		rb_funcall(ruby_class, rb_intern("method_added"),
-			   1, INT2FIX(node->nd_mid));
+		rb_funcall(ruby_class, added, 1, ID2SYM(node->nd_mid));
 	    }
 	    result = Qnil;
@@ -2806,6 +2806,5 @@ rb_eval(self, node)
 	    rb_add_method(klass, node->nd_mid, node->nd_defn, 
 			  NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
-	    rb_funcall(recv, rb_intern("singleton_method_added"),
-		       1, INT2FIX(node->nd_mid));
+	    rb_funcall(recv, singleton_added, 1, ID2SYM(node->nd_mid));
 	    result = Qnil;
 	}
@@ -2825,6 +2824,5 @@ rb_eval(self, node)
 	}
 	rb_alias(ruby_class, node->nd_new, node->nd_old);
-	rb_funcall(ruby_class, rb_intern("method_added"),
-		   1, INT2FIX(node->nd_mid));
+	rb_funcall(ruby_class, added, 1, ID2SYM(node->nd_mid));
 	result = Qnil;
 	break;
@@ -4398,8 +4396,7 @@ void
 rb_backtrace()
 {
-    int i, lev;
+    int i;
     VALUE ary;
 
-    lev = INT2FIX(0);
     ary = backtrace(-1);
     for (i=0; i<RARRAY(ary)->len; i++) {
@@ -4411,7 +4408,4 @@ static VALUE
 make_backtrace()
 {
-    VALUE lev;
-
-    lev = INT2FIX(0);
     return backtrace(-1);
 }
@@ -5130,4 +5124,5 @@ rb_mod_modfunc(argc, argv, module)
 	rb_clear_cache_by_id(id);
 	rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
+	rb_funcall(module, singleton_added, 1, ID2SYM(id));
     }
     return module;
@@ -5399,4 +5394,6 @@ Init_eval()
     match = rb_intern("=~");
     missing = rb_intern("method_missing");
+    added = rb_intern("method_added");
+    singleton_added = rb_intern("singleton_method_added");
 
     rb_global_variable((VALUE*)&top_scope);

-- 
そうだ 強気に ちょっと インチキに☆彡
    中田 "Bugるくらいがちょうどいいかも;-)" 伸悦

In This Thread

Prev Next