Index: src/pmc/resizablepmcarray.pmc =================================================================== --- src/pmc/resizablepmcarray.pmc (revision 16208) +++ src/pmc/resizablepmcarray.pmc (working copy) @@ -205,8 +205,6 @@ if (key >= PMC_int_val(SELF)) DYNSELF.set_integer_native(key+1); data = PMC_data(SELF); - if (data[key] == PMCNULL) - data[key] = pmc_new(INTERP, enum_class_Undef); return data[key]; } Index: src/pmc/array.pmc =================================================================== --- src/pmc/array.pmc (revision 16208) +++ src/pmc/array.pmc (working copy) @@ -22,25 +22,9 @@ /* -=item C - -Returns a C PMC. - -=cut - -*/ - -static PMC* undef(Interp* interp) -{ - return pmc_new(interp, enum_class_Undef); -} - -/* - =item C -Processes C<*ret>, returning the appropriate PMC, or raising an -exception if necessary. +Processes C<*ret>, returning PMCNULL if needed. =cut @@ -48,20 +32,7 @@ static PMC* retval(Interp *interp, void *ret) { - PMC *value; - if (ret == 0) - real_exception(interp, NULL, E_IndexError, - "Array index out of bounds!"); - /* XXX getting non existent value, exception or undef? - * current is for perlarray */ - if (ret == (void*) -1) - value = undef(interp); - else { - value = *(PMC**) ret; - if (value == NULL) /* XXX same here */ - value = undef(interp); - } - return value; + return ret == 0 || ret == (void*) -1 ? PMCNULL : (PMC*)ret; } /* @@ -88,7 +59,7 @@ "Array index out of bounds!"); /* assign into a sparse or not yet set value */ if (ret == (void*) -1 || *(PMC**)ret == 0) { - value = undef(interp); + value = PMCNULL; list_assign(interp, list, key, value, enum_type_PMC); } else @@ -348,7 +319,8 @@ if (nextkey == NULL) return SELF.get_integer_keyed_int(ix); box = SELF.get_pmc_keyed_int(ix); - if (box == NULL) box = undef(INTERP); + if (box == NULL) + box = PMCNULL; return VTABLE_get_integer_keyed(INTERP, box, nextkey); } @@ -391,7 +363,8 @@ if (nextkey == NULL) return SELF.get_number_keyed_int(ix); box = SELF.get_pmc_keyed_int(ix); - if (box == NULL) box = undef(INTERP); + if (box == NULL) + box = PMCNULL; return VTABLE_get_number_keyed(INTERP, box, nextkey); } @@ -433,7 +406,8 @@ if (nextkey == NULL) return SELF.get_string_keyed_int(ix); box = SELF.get_pmc_keyed_int(ix); - if (box == NULL) box = undef(INTERP); + if (box == NULL) + box = PMCNULL; return VTABLE_get_string_keyed(INTERP, box, nextkey); } @@ -473,7 +447,8 @@ if (nextkey == NULL) return SELF.get_pmc_keyed_int(ix); box = SELF.get_pmc_keyed_int(ix); - if (box == NULL) box = undef(INTERP); + if (box == NULL) + box = PMCNULL; return VTABLE_get_pmc_keyed(INTERP, box, nextkey); } @@ -774,7 +749,7 @@ */ void unshift_integer (INTVAL value) { - PMC * val = undef(INTERP); + PMC * val = PMCNULL; list_unshift(INTERP, (List*)PMC_data(SELF), val, enum_type_PMC); VTABLE_set_integer_native(INTERP, val, value); } @@ -791,7 +766,7 @@ */ void unshift_float (FLOATVAL value) { - PMC * val = undef(INTERP); + PMC * val = PMCNULL; list_unshift(INTERP, (List*)PMC_data(SELF), val, enum_type_PMC); VTABLE_set_number_native(INTERP, val, value); } @@ -808,7 +783,7 @@ */ void unshift_string (STRING *value) { - PMC * val = undef(INTERP); + PMC * val = PMCNULL; list_unshift(INTERP, (List*)PMC_data(SELF), val, enum_type_PMC); VTABLE_set_string_native(INTERP, val, value); } @@ -1277,10 +1252,6 @@ F, F -=head1 TODO - -Create global immutable undef object. - =cut */