Author: julianalbo Date: Fri Jan 23 14:54:17 2009 New Revision: 35930 Modified: trunk/src/pmc/complex.pmc
Log: allow String subclasses in Complex init_pmc Modified: trunk/src/pmc/complex.pmc ============================================================================== --- trunk/src/pmc/complex.pmc (original) +++ trunk/src/pmc/complex.pmc Fri Jan 23 14:54:17 2009 @@ -366,13 +366,19 @@ FLOATVAL im = VTABLE_get_number_keyed_int(interp, initializer, 1); SET_ATTR_re(INTERP, SELF, re); SET_ATTR_im(INTERP, SELF, im); - break; + break; } /* else let it fall to default */ default: - Parrot_ex_throw_from_c_args(interp, NULL, - EXCEPTION_INVALID_OPERATION, - "Invalid Complex initializer"); + if (VTABLE_isa(interp, initializer, CONST_STRING(interp, "String"))) { + STRING * s = VTABLE_get_string(interp, initializer); + SELF.set_string_native(s); + } + else { + Parrot_ex_throw_from_c_args(interp, NULL, + EXCEPTION_INVALID_OPERATION, + "Invalid Complex initializer"); + } } }