cvsuser 05/04/05 07:44:48
Modified: dynclasses pystring.pmc
src mmd.c
Log:
fix test errors
* PyStrings didn't mark the contained STRING
* a Sub can override a builtin multi too
Revision Changes Path
1.21 +20 -4 parrot/dynclasses/pystring.pmc
Index: pystring.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pystring.pmc,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- pystring.pmc 12 Jan 2005 15:01:20 -0000 1.20
+++ pystring.pmc 5 Apr 2005 14:44:47 -0000 1.21
@@ -25,6 +25,21 @@
/*
+=item C<void mark()>
+
+Marks the string as live.
+
+=cut
+
+*/
+
+ void mark () {
+ if(PMC_str_val(SELF))
+ pobject_lives(INTERP, (PObj *)PMC_str_val(SELF));
+ }
+
+/*
+
=item C<PMC* "__getitem__"(PMC *self, PMC *index)>
Returns the PMC value of the element at index C<key>.
@@ -245,7 +260,7 @@
INTVAL start = RVal_int(range->start);
INTVAL end = RVal_int(range->end);
PMC * ret = pmc_new(INTERP, PyBuiltin_PyString);
- PMC_str_val(ret) = string_substr(INTERP, PMC_str_val(SELF),
+ PMC_str_val(ret) = string_substr(INTERP, PMC_str_val(SELF),
start, end-start, NULL, 0);
return ret;
}
@@ -498,12 +513,12 @@
STRING *s;
if (!VTABLE_get_bool(INTERP, iter))
- s = string_from_cstring(INTERP, "", 0);
+ s = string_from_cstring(INTERP, "", 0);
else {
s = VTABLE_shift_string(INTERP, iter);
while (VTABLE_get_bool(INTERP, iter)) {
s = string_append(INTERP, s, PMC_str_val(self), 0);
- s = string_append(INTERP, s,
+ s = string_append(INTERP, s,
VTABLE_get_string(INTERP, iter), 0);
}
}
@@ -609,6 +624,7 @@
void set_string_native (STRING * value) {
PMC_str_val(SELF) = value;
+ PObj_custom_mark_SET(SELF);
}
/*
1.66 +6 -4 parrot/src/mmd.c
Index: mmd.c
===================================================================
RCS file: /cvs/public/parrot/src/mmd.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- mmd.c 5 Apr 2005 14:07:33 -0000 1.65
+++ mmd.c 5 Apr 2005 14:44:48 -0000 1.66
@@ -1093,7 +1093,7 @@
}
/*
* now consider MRO of types the signature type has to be somewhere
- * int the MRO of the type_call
+ * in the MRO of the type_call
*/
mro = Parrot_base_vtables[type_call]->mro;
m = VTABLE_elements(interpreter, mro);
@@ -1431,7 +1431,7 @@
{
const char *name, *short_name;
char signature[6], val_sig;
- STRING *meth_name, *ns;
+ STRING *meth_name, *ns, *_sub;
int len;
char *p;
PMC *method, *multi, *class, *multi_sig;
@@ -1490,8 +1490,10 @@
VTABLE_add_method(interpreter, class, meth_name, method);
}
else {
+ _sub = CONST_STRING(interpreter, "Sub");
/* multiple methods with that same name */
- if (method->vtable->base_type == enum_class_NCI) {
+ if (method->vtable->base_type == enum_class_NCI ||
+ VTABLE_isa(interpreter, method, _sub)) {
/* convert first to a multi */
multi = constant_pmc_new(interpreter, enum_class_MultiSub);
VTABLE_add_method(interpreter, class, meth_name, multi);