[PATCH] void functions can't return values.

1 view
Skip to first unread message

Andy Dougherty

unread,
Mar 22, 2007, 8:50:38 AM3/22/07
to Perl6 Internals
Void functions can't try to return anything. I haven't checked if this
patch is "right" or not. The documentation for Parrot_set_attrib_by_num()
claims it returns a PMC *, but the source code uses 'void' and doesn't
actually return anything. I don't know what the intended behavior
actually is.

This patch at least lets it compile.

--- parrot-current/src/pmc/parrotobject.pmc 2007-03-16 11:15:15.000000000 -0400
+++ parrot-andy/src/pmc/parrotobject.pmc 2007-03-21 11:50:28.569996000 -0400
@@ -207,8 +207,10 @@
PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v);
if (PMC_IS_NULL(sub))
sub = find_meth(interp, SELF, meth);
- if (PMC_IS_NULL(sub))
- return Parrot_set_attrib_by_num(INTERP, SELF, idx, value);
+ if (PMC_IS_NULL(sub)) {
+ Parrot_set_attrib_by_num(INTERP, SELF, idx, value);
+ return ;
+ }
(PMC*) Parrot_run_meth_fromc_args(interp, sub,
SELF, meth, "vIP", idx, value);
}
@@ -219,8 +221,10 @@
PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v);
if (PMC_IS_NULL(sub))
sub = find_meth(interp, SELF, meth);
- if (PMC_IS_NULL(sub))
- return Parrot_set_attrib_by_str(INTERP, SELF, idx, value);
+ if (PMC_IS_NULL(sub)) {
+ Parrot_set_attrib_by_str(INTERP, SELF, idx, value);
+ return;
+ }
(PMC*) Parrot_run_meth_fromc_args(interp, sub,
SELF, meth, "vSP", idx, value);
}

--
Andy Dougherty doug...@lafayette.edu

Reply all
Reply to author
Forward
0 new messages