From a579f3160bbbac4b9fd1ee3d541c0426741976c1 Mon Sep 17 00:00:00 2001 From: pmichaud Date: Fri, 8 May 2009 15:34:22 -0500 Subject: [PATCH 1/2] spectest-progress.csv update: 383 files, 11032 passing, 0 failing --- docs/spectest-progress.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/spectest-progress.csv b/docs/spectest-progress.csv index 8d5292ef898..468770e18e4 100644 --- a/docs/spectest-progress.csv +++ b/docs/spectest-progress.csv @@ -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 From f01d5d6bae6a5d319a96fae1548751360b3ef28a Mon Sep 17 00:00:00 2001 From: jnthn Date: Sat, 9 May 2009 00:02:46 +0200 Subject: [PATCH 2/2] Make the default parameter type of routines be Any, and the default type of pointy blocks and others be Object. Resolves RT#63920 and brings us in line with the spec. --- src/classes/Signature.pir | 19 +++++++++++++++++-- src/parser/actions.pm | 8 +++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/classes/Signature.pir b/src/classes/Signature.pir index 73d36c6d94b..cc786c2d215 100644 --- a/src/classes/Signature.pir +++ b/src/classes/Signature.pir @@ -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 @@ -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 @@ -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. diff --git a/src/parser/actions.pm b/src/parser/actions.pm index 80eb47528d8..7ce81b6c6f0 100644 --- a/src/parser/actions.pm +++ b/src/parser/actions.pm @@ -773,6 +773,7 @@ method routine_def($/) { } $block.control(return_handler_past()); block_signature($block); + $block.name('Any'); if $ { my $loadinit := $block.loadinit(); @@ -814,6 +815,7 @@ method method_def($/) { $block.control(return_handler_past()); block_signature($block); + $block.name('Any'); # Ensure there's an invocant in the signature. $block.loadinit().push(PAST::Op.new( :pasttype('callmethod'), @@ -3007,10 +3009,14 @@ sub set_package_magical() { sub block_signature($block) { unless $block { + $block := 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 ) ); $block := 1;