summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-28 09:39:43 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-28 09:39:43 +0000
commit1e8a6745b088100bfe6cc7f004e6dbd4558ad47c (patch)
treedb09e8856a62b07ed14308bf2ccbc9c4e359e3c2 /vm_method.c
parentc6252206717f4cfa376f9731b5535b12ea71fece (diff)
merges r21084 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@21113 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);