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 Feb 16, 2010
2 parents 04f3504 + ff97a28 commit 33b1bf9
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 21 deletions.
14 changes: 8 additions & 6 deletions src/Perl6/Actions.pm
Expand Up @@ -97,13 +97,15 @@ method statementlist($/) {
if $<statement> {
for $<statement> {
my $ast := $_.ast;
if $ast.isa(PAST::Block) && !$ast.blocktype {
$ast := block_immediate($ast);
}
elsif $ast<past_block> && !$ast<past_block>.blocktype {
$ast := block_immediate($ast<past_block>);
if $ast {
if $ast.isa(PAST::Block) && !$ast.blocktype {
$ast := block_immediate($ast);
}
elsif $ast<past_block> && !$ast<past_block>.blocktype {
$ast := block_immediate($ast<past_block>);
}
$past.push( $ast );
}
$past.push( $ast );
}
}
make $past;
Expand Down
11 changes: 10 additions & 1 deletion src/Perl6/Compiler/Parameter.pm
Expand Up @@ -86,7 +86,16 @@ method default_from_outer($default_from_outer?) {
}

method nom_type($nom_type?) {
if $nom_type { $!nom_type := $nom_type }
if $nom_type {
if $nom_type.isa(PAST::Op) && $nom_type.name() eq 'new' {
# It's a thunk (cretion of a new code block); we'll make this
# a constraint.
self.cons_types.push($nom_type)
}
else {
$!nom_type := $nom_type
}
}
$!nom_type
}

Expand Down
6 changes: 3 additions & 3 deletions src/Perl6/Compiler/Signature.pm
Expand Up @@ -232,16 +232,16 @@ method ast($high_level?) {
:scope('package')
);
}
else {
else {
$nom_type := $_.nom_type;
}
}
}
elsif $_.sigil ne "" && !$_.invocant {
# May well be a parametric role based type.
my $role_name;
if $_.sigil eq "@" { $role_name := "Positional" }
elsif $_.sigil eq "%" { $role_name := "Associative" }
elsif $_.sigil ne ":" { $role_name := "Callable" }
elsif $_.sigil eq "&" { $role_name := "Callable" }
if $role_name {
my $role_type := PAST::Var.new( :name($role_name), :namespace(''), :scope('package') );
if !$_.nom_type {
Expand Down
2 changes: 2 additions & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -944,6 +944,8 @@ token postfixish {
# last whitespace didn't end here
<!MARKED('ws')>

[ <.unsp> | '\\' ]?

<postfix_prefix_meta_operator>?
[
| <OPER=dotty>
Expand Down
5 changes: 3 additions & 2 deletions src/binder/bind.c
Expand Up @@ -311,8 +311,9 @@ Rakudo_binding_bind_one_param(PARROT_INTERP, PMC *lexpad, llsig_element *sig_inf
for (i = 0; i < num_constraints; i++) {
PMC *cons_type = VTABLE_get_pmc_keyed_int(interp, constraints, i);
PMC *accepts_meth = VTABLE_find_method(interp, cons_type, ACCEPTS);
if (VTABLE_isa(interp, cons_type, string_from_literal(interp, "Sub")))
Parrot_capture_lex(interp, cons_type);
if (VTABLE_isa(interp, cons_type, string_from_literal(interp, "Block")))
Parrot_capture_lex(interp, VTABLE_get_attr_str(interp, cons_type,
string_from_literal(interp, "$!do")));
Parrot_ext_call(interp, accepts_meth, "PiP->P", cons_type, value, &result);
if (!VTABLE_get_bool(interp, result)) {
if (error)
Expand Down
29 changes: 29 additions & 0 deletions src/builtins/Routine.pir
Expand Up @@ -26,6 +26,35 @@ wrappable executable objects.

=over 4

=item assumming()

Returns a curried version of self.

=cut

.sub 'assuming' :method :subid('assuming')
.param pmc args :slurpy
.param pmc named_args :slurpy :named
.local pmc curried
.lex '@args', args
.lex '%args', named_args
.lex '$obj', self
.const 'Sub' curried = 'assuming_helper'
$P0 = newclosure curried
.return ($P0)
.end

.sub '' :outer('assuming') :subid('assuming_helper')
.param pmc args :slurpy
.param pmc named_args :slurpy :named
.local pmc obj, assumed_args, assumed_named_args, result
find_lex obj, '$obj'
find_lex assumed_args, '@args'
find_lex assumed_named_args, '%args'
.tailcall obj(assumed_args :flat, args :flat, assumed_named_args :flat :named, named_args :flat :named)
.end


=item wrap

=cut
Expand Down
2 changes: 1 addition & 1 deletion src/core/Any-num.pm
Expand Up @@ -84,7 +84,7 @@ augment class Any {
self.Num.tan($base);
}

our Num multi method sec($base = 'radians') is export {
our Num multi method sec($base = 'radians') {
self.Num.sec($base);
}

Expand Down
3 changes: 2 additions & 1 deletion src/core/Bool.pm
@@ -1,3 +1,4 @@
augment class Bool {
method Bool { self }
}
method ACCEPTS($topic) { self }
}
2 changes: 1 addition & 1 deletion src/core/Num.pm
Expand Up @@ -139,7 +139,7 @@ augment class Num {
}

multi method cosech($base = 'radians') {
1 / self.cosh($base);
1 / self.sinh($base);
}

multi method acosech($base = 'radians') {
Expand Down
12 changes: 6 additions & 6 deletions t/spectest.data
Expand Up @@ -154,7 +154,7 @@ S03-operators/scalar-assign.t
# S03-smartmatch/any-any.t
# S03-smartmatch/any-array-slice.t
# S03-smartmatch/any-array.t
# S03-smartmatch/any-bool.t
S03-smartmatch/any-bool.t
S03-smartmatch/any-callable.t
S03-smartmatch/any-complex.t
# S03-smartmatch/any-hash-pair.t
Expand Down Expand Up @@ -263,14 +263,14 @@ S05-metasyntax/single-quotes.t
# S05-transliteration/with-closure.t
S06-advanced_subroutine_features/lexical-subs.t
# S06-advanced_subroutine_features/recurse.t
# S06-advanced_subroutine_features/return.t
S06-advanced_subroutine_features/return.t
# S06-advanced_subroutine_features/wrap.t
# S06-currying/assuming-and-mmd.t
# S06-currying/named.t
S06-currying/assuming-and-mmd.t
S06-currying/named.t
# S06-multi/lexical-multis.t
# S06-multi/proto.t
S06-multi/proto.t
S06-multi/syntax.t
# S06-multi/type-based.t
S06-multi/type-based.t
S06-multi/value-based.t
# S06-operator-overloading/imported-subs.t
# S06-operator-overloading/sub.t
Expand Down

0 comments on commit 33b1bf9

Please sign in to comment.