cvsuser 04/03/26 02:09:32
Modified: classes parrotobject.pmc
src objects.c
Log:
preserve array type during clone_rray
Revision Changes Path
1.24 +5 -3 parrot/classes/parrotobject.pmc
Index: parrotobject.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/parrotobject.pmc,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -w -r1.23 -r1.24
--- parrotobject.pmc 17 Mar 2004 08:54:30 -0000 1.23
+++ parrotobject.pmc 26 Mar 2004 10:09:27 -0000 1.24
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: parrotobject.pmc,v 1.23 2004/03/17 08:54:30 leo Exp $
+$Id: parrotobject.pmc,v 1.24 2004/03/26 10:09:27 leo Exp $
=head1 NAME
@@ -115,7 +115,9 @@
STRING* name() {
- return VTABLE_get_string(INTERP, (PMC *)get_attrib_num((Buffer
*)PMC_data(SELF), POD_CLASS_NAME));
+ return VTABLE_get_string(INTERP,
+ (PMC *)get_attrib_num((Buffer *)PMC_data(SELF),
+ POD_CLASS_NAME));
}
@@ -130,7 +132,7 @@
*/
PMC* find_method(STRING* name) {
- PMC *class = get_attrib_num((PMC *)PMC_data(SELF), 0);
+ PMC *class = get_attrib_num((PMC *)PMC_data(SELF), POD_CLASS);
return Parrot_find_method_with_cache(INTERP, class, name);
}
1.66 +9 -4 parrot/src/objects.c
Index: objects.c
===================================================================
RCS file: /cvs/public/parrot/src/objects.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -w -r1.65 -r1.66
--- objects.c 25 Mar 2004 13:36:57 -0000 1.65
+++ objects.c 26 Mar 2004 10:09:32 -0000 1.66
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: objects.c,v 1.65 2004/03/25 13:36:57 leo Exp $
+$Id: objects.c,v 1.66 2004/03/26 10:09:32 leo Exp $
=head1 NAME
@@ -23,12 +23,17 @@
static PMC *
-clone_array(Parrot_Interp interpreter, PMC *source_array) {
+clone_array(Parrot_Interp interpreter, PMC *source_array)
+{
PMC *new_array;
INTVAL count;
INTVAL i;
+
count = VTABLE_elements(interpreter, source_array);
- new_array = pmc_new(interpreter, enum_class_Array);
+ /*
+ * preserve type, we have OrderedHash and Array
+ */
+ new_array = pmc_new(interpreter, source_array->vtable->base_type);
VTABLE_set_integer_native(interpreter, new_array, count);
for (i = 0; i < count; i++) {
VTABLE_set_pmc_keyed_int(interpreter, new_array, i,