Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed May 8, 2009
2 parents 6ceb326 + f01d5d6 commit 43f257d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/spectest-progress.csv
Expand Up @@ -349,3 +349,5 @@
"2009-05-04 00:00",cddb162,10999,11,365,2190,13565,16487,379
"2009-05-05 00:00",4d7fe56,11011,0,364,2190,13565,16490,379
"2009-05-06 00:00",71c69d0,11013,0,364,2191,13568,16490,380
"2009-05-07 00:00",615936e,11022,0,365,2195,13582,16492,382
"2009-05-08 00:00",6db88b0,11032,0,365,2195,13592,16495,383
19 changes: 17 additions & 2 deletions src/classes/Signature.pir
Expand Up @@ -36,7 +36,7 @@ Again, this probably isn't definitive either, but it'll get us going.
load_bytecode 'PCT.pbc'
.local pmc p6meta
p6meta = get_hll_global ['Perl6Object'], '$!P6META'
p6meta.'new_class'('Signature', 'parent'=>'Any', 'attr'=>'@!params')
p6meta.'new_class'('Signature', 'parent'=>'Any', 'attr'=>'@!params $!default_type')
.end
=head2 Methods
Expand Down Expand Up @@ -126,7 +126,9 @@ the Signature.
all_types = new 'ResizablePMCArray'
unless null type goto have_type
unless null role_type goto simple_role_type
type = get_hll_global 'Any'
type = getattribute self, '$!default_type'
unless null type goto done_role_type
type = get_hll_global 'Object'
goto done_role_type
simple_role_type:
type = role_type
Expand Down Expand Up @@ -155,6 +157,19 @@ the Signature.
.end
=item !set_default_param_type
Sets the default parameter type if none is supplied (since it differs for
blocks and routines).
=cut
.sub '!set_default_param_type' :method
.param pmc type
setattribute self, '$!default_type', type
.end
=item !add_implicit_self
Ensures that if there is no explicit invocant, we add one.
Expand Down
8 changes: 7 additions & 1 deletion src/parser/actions.pm
Expand Up @@ -773,6 +773,7 @@ method routine_def($/) {
}
$block.control(return_handler_past());
block_signature($block);
$block<default_param_type_node>.name('Any');

if $<trait> {
my $loadinit := $block.loadinit();
Expand Down Expand Up @@ -814,6 +815,7 @@ method method_def($/) {

$block.control(return_handler_past());
block_signature($block);
$block<default_param_type_node>.name('Any');
# Ensure there's an invocant in the signature.
$block.loadinit().push(PAST::Op.new(
:pasttype('callmethod'),
Expand Down Expand Up @@ -3007,10 +3009,14 @@ sub set_package_magical() {

sub block_signature($block) {
unless $block<signature> {
$block<default_param_type_node> := PAST::Var.new(
:scope('package'), :name('Object'), :namespace(list()) );
$block.loadinit().push(
PAST::Op.new( :inline(' .local pmc signature',
' signature = new ["Signature"]',
' setprop block, "$!signature", signature')
' setprop block, "$!signature", signature',
' signature."!set_default_param_type"(%0)'),
$block<default_param_type_node>
)
);
$block<signature> := 1;
Expand Down

0 comments on commit 43f257d

Please sign in to comment.