summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-27 03:57:21 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-27 03:57:21 +0000
commitb30b998966553a614f18703536b49a4dc273e0c6 (patch)
tree08400ea71783592d249227c384eeb28e85801bef /vm_method.c
parent597220ef0c694a74663e064b73605bd48ad7250b (diff)
* vm_insnhelper.c (vm_call_method, vm_call_cfunc): use original id instead of
calling id when NODE_CFUNC or NODE_BMETHOD. fixes Bug #632 [ruby-core:19282]. * vm_eval.c (vm_call0, vm_call_super): ditto. * vm_method.c (rb_add_method, rb_alias): store original id in nd_file field of NODE_METHOD. * test/stringio/test_stringio.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/vm_method.c b/vm_method.c
index f3387ed506..774fa1eda9 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -129,6 +129,7 @@ rb_add_method(VALUE klass, ID mid, NODE * node, int noex)
/*
* NODE_METHOD (NEW_METHOD(body, klass, vis)):
+ * nd_file : original id // RBASIC()->klass (TODO: dirty hack)
* nd_body : method body // (2) // mark
* nd_clss : klass // (1) // mark
* nd_noex : visibility // (3)
@@ -139,7 +140,9 @@ rb_add_method(VALUE klass, ID mid, NODE * node, int noex)
* nd_cnt : alias count // (3)
*/
if (node) {
- body = NEW_FBODY(NEW_METHOD(node, klass, NOEX_WITH_SAFE(noex)), 0);
+ NODE *method = NEW_METHOD(node, klass, NOEX_WITH_SAFE(noex));
+ method->nd_file = (void *)mid;
+ body = NEW_FBODY(method, mid);
}
else {
body = 0;
@@ -725,7 +728,7 @@ rb_mod_protected_method_defined(VALUE mod, VALUE mid)
void
rb_alias(VALUE klass, ID name, ID def)
{
- NODE *orig_fbody, *node;
+ NODE *orig_fbody, *node, *method;
VALUE singleton = 0;
st_data_t data;
@@ -762,9 +765,10 @@ rb_alias(VALUE klass, ID name, ID def)
st_insert(RCLASS_M_TBL(klass), name,
(st_data_t) NEW_FBODY(
- NEW_METHOD(orig_fbody->nd_body->nd_body,
+ method = NEW_METHOD(orig_fbody->nd_body->nd_body,
orig_fbody->nd_body->nd_clss,
NOEX_WITH_SAFE(orig_fbody->nd_body->nd_noex)), def));
+ method->nd_file = (void *)def;
rb_clear_cache_by_id(name);