Skip to content

Commit

Permalink
several fixes from bad copy+paste. Add in a test for 'can' override
Browse files Browse the repository at this point in the history
  • Loading branch information
Whiteknight committed Mar 4, 2011
1 parent 6bafefc commit cf26847
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/pmc/object.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ non-zero value if it does.

if (!PMC_IS_NULL(method)) {
INTVAL result = 0;
Parrot_ext_call(INTERP, method, "PiS->I", SELF, &result);
Parrot_ext_call(INTERP, method, "PiS->I", SELF, method_name, &result);
return result;
}
else {
Expand Down Expand Up @@ -681,7 +681,7 @@ Returns whether the object's class is or inherits from C<*classname>.

if (!PMC_IS_NULL(method)) {
INTVAL result = 0;
Parrot_ext_call(INTERP, method, "PiP->I", SELF, &result);
Parrot_ext_call(INTERP, method, "PiP->I", SELF, lookup, &result);
return result;
}

Expand Down Expand Up @@ -711,7 +711,7 @@ Returns whether the class is or inherits from C<*classname>.

if (!PMC_IS_NULL(method)) {
INTVAL result = 0;
Parrot_ext_call(INTERP, method, "PiS->I", SELF, &result);
Parrot_ext_call(INTERP, method, "PiS->I", SELF, classname, &result);
return result;
}
else if (SELF->vtable->whoami == classname
Expand Down
22 changes: 21 additions & 1 deletion t/pmc/object-meths.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
use Parrot::Test tests => 37;
use Parrot::Test tests => 38;

=head1 NAME
Expand Down Expand Up @@ -1121,6 +1121,26 @@ CODE
/Method 'new' not found for non-object/
OUTPUT

pir_output_is( <<'CODE', <<'OUTPUT', "overloading can vtable" );
.namespace [ 'Foo' ]
.sub 'can' :vtable("can") :method
.param string role
.return(1)
.end
.namespace []
.sub main :main
$P0 = newclass "Foo"
$P1 = new $P0
$I0 = can $P1, "no_method_i_ever_heard_of"
say $I0
.end
CODE
1
OUTPUT

# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Expand Down

0 comments on commit cf26847

Please sign in to comment.