summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-11 08:13:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-11 08:13:42 +0000
commite956f28724a40de9b51b8d049e259af96dc738d5 (patch)
tree9ab567e01bbd9312a34ed2c1c8139b0852236a7a /class.c
parent5898c07466e097955e9519d576c90486c5410cfb (diff)
* class.c (clone_method): should copy cbase in cref as well.
[ruby-dev:35116] * iseq.c (iseq_mark): mark original iseq object. * iseq.c (iseq_free): do not free internal data if they have original iseq to belong. * iseq.c (rb_iseq_clone): a new function to clone iseq value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/class.c b/class.c
index 0d612a5e87..91ba3e6361 100644
--- a/class.c
+++ b/class.c
@@ -13,6 +13,7 @@
#include "ruby/signal.h"
#include "ruby/node.h"
#include "ruby/st.h"
+#include "vm_core.h"
#include <ctype.h>
extern st_table *rb_class_tbl;
@@ -78,10 +79,17 @@ clone_method(ID mid, NODE *body, struct clone_method_data *data)
st_insert(data->tbl, mid, 0);
}
else {
+ NODE *fbody = body->nd_body->nd_body;
+
+ if (nd_type(fbody) == RUBY_VM_METHOD_NODE) {
+ fbody = NEW_NODE(RUBY_VM_METHOD_NODE, 0,
+ rb_iseq_clone((VALUE)fbody->nd_body, data->klass),
+ 0);
+ }
st_insert(data->tbl, mid,
(st_data_t)
NEW_FBODY(
- NEW_METHOD(body->nd_body->nd_body,
+ NEW_METHOD(fbody,
data->klass, /* TODO */
body->nd_body->nd_noex),
0));