Skip to content

Instantly share code, notes, and snippets.

@FROGGS
Created April 22, 2014 13:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save FROGGS/a78ff92ec5e7ce2f8fda to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index 183467f..1af8fdd 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -3540,19 +3540,24 @@ class Perl6::Actions is HLL::Actions does STDActions {
my int $param_idx := 0;
my int $multi_invocant := 1;
for $<parameter> {
- my %info := $_.ast;
- %info<is_multi_invocant> := $multi_invocant;
- my $sep := @*seps[$param_idx];
- if ~$sep eq ':' {
- if $param_idx != 0 {
- $*W.throw($/, 'X::Syntax::Signature::InvocantMarker')
- }
- %info<is_invocant> := 1;
+ if ~$_ eq '*' {
+ @parameter_infos.push({});
}
- elsif ~$sep eq ';;' {
- $multi_invocant := 0;
+ else {
+ my %info := $_.ast;
+ %info<is_multi_invocant> := $multi_invocant;
+ my $sep := @*seps[$param_idx];
+ if ~$sep eq ':' {
+ if $param_idx != 0 {
+ $*W.throw($/, 'X::Syntax::Signature::InvocantMarker')
+ }
+ %info<is_invocant> := 1;
+ }
+ elsif ~$sep eq ';;' {
+ $multi_invocant := 0;
+ }
+ @parameter_infos.push(%info);
}
- @parameter_infos.push(%info);
$param_idx := $param_idx + 1;
}
%signature<parameters> := @parameter_infos;
diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp
index fa8a306..6bd032d 100644
--- a/src/Perl6/Grammar.nqp
+++ b/src/Perl6/Grammar.nqp
@@ -2458,7 +2458,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<.ws>
[
| <?before '-->' | ')' | ']' | '{' | ':'\s | ';;' >
- | [ <parameter> || <.malformed('parameter')> ]
+ | [ <parameter> || $<parameter>='*' || <.malformed('parameter')> ]
]+ % <param_sep>
<.ws>
{ $*IN_DECL := ''; }
@FROGGS
Copy link
Author

FROGGS commented Apr 22, 2014

perl6-m -e 'my (*, *, $x) = (1, 2, 3); say $x'
3

@FROGGS
Copy link
Author

FROGGS commented Apr 24, 2014

--> allow my $x; ($, $, $x) = 1, 2, 3 instead
http://irclog.perlgeek.de/perl6/2014-04-24#i_8633629

@FROGGS
Copy link
Author

FROGGS commented Sep 29, 2014

<FROGGS> m: my $x; ($, $, $x) = 1, 2, 3; say $x
<camelia> rakudo-moar 502241: OUTPUT«3␤»

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment