Ticket #1262 (closed patch: done)
Simple patch for the overriding of invoke for objects
| Reported by: | NotFound | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | none | Version: | 1.7.0 |
| Severity: | medium | Keywords: | |
| Cc: | Language: | ||
| Patch status: | applied | Platform: |
Description
This simple change makes object() works as expected for the short test case I tried:
Index: src/pmc/object.pmc
===================================================================
--- src/pmc/object.pmc (revision 42404)
+++ src/pmc/object.pmc (working copy)
@@ -616,8 +616,11 @@
PMC * const meth =
Parrot_oo_find_vtable_override_for_class(interp, cur_class,
meth_name);
- if (!PMC_IS_NULL(meth))
+ if (!PMC_IS_NULL(meth)) {
+ PMC *call_sig = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
+ VTABLE_unshift_pmc(interp, call_sig, SELF);
return VTABLE_invoke(interp, meth, next);
+ }
if (cur_class->vtable->base_type == enum_class_PMCProxy) {
/* Get the PMC instance and call the vtable method on that. */
This is the test:
.sub main :main $P0 = newclass ['myobj'] addattribute $P0, 'name' $P1 = new $P0 $P3 = new 'String' $P3 = 'world' setattribute $P1, 'name', $P3 $P1() .end .namespace ['myobj'] .sub hello :method print 'hello, ' $P1 = getattribute self, 'name' say $P1 .end .sub 'invoke' :vtable self.'hello'() .end
Change History
Note: See
TracTickets for help on using
tickets.
