1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ko1 2008-12-27 03:57:21 +00:00
parent 597220ef0c
commit b30b998966
5 changed files with 43 additions and 11 deletions

View file

@ -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);