cvsuser 04/09/07 05:18:42
Modified: classes delegate.pmc
Log:
fix new_extended delegation
Revision Changes Path
1.29 +22 -2 parrot/classes/delegate.pmc
Index: delegate.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/delegate.pmc,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -r1.28 -r1.29
--- delegate.pmc 13 Aug 2004 10:44:55 -0000 1.28
+++ delegate.pmc 7 Sep 2004 12:18:42 -0000 1.29
@@ -1,6 +1,6 @@
/*
Copyright: 2003 The Perl Foundation. All Rights Reserved.
-$Id: delegate.pmc,v 1.28 2004/08/13 10:44:55 leo Exp $
+$Id: delegate.pmc,v 1.29 2004/09/07 12:18:42 leo Exp $
=head1 NAME
@@ -151,7 +151,15 @@
=item C<void init()>
-Calls the delegated C<init()> method.
+Calls the delegated C<__init()> method if it exists.
+
+=item C<PMC* new_extended()>
+
+Calls the delegated C<__new_extended> method if it exists.
+
+XXX Actually the PMC compiler should emit different code, if a method is
+present in classes/default.pmc. Some defaulted methods like this one have
+useful defaults and don't throw exceptiions.
=cut
@@ -168,6 +176,18 @@
void destroy() {
/* don't delegate destroy */
}
+
+ PMC* new_extended() {
+ STRING *meth = const_string(interpreter,
+ PARROT_VTABLE_NEW_EXTENDED_METHNAME );
+ PMC *sub = find_meth(interpreter, SELF, meth);
+ if (PMC_IS_NULL(sub)) {
+ /* run default fallback that constructs an empty object */
+ return SUPER();
+ }
+ return (PMC*) Parrot_run_meth_fromc_args_save(interpreter, sub,
+ pmc, meth, "P");
+ }
}
/*