Skip to content

Commit

Permalink
Fix calling functions without arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan O'Rear committed Jul 14, 2010
1 parent ece8139 commit f5fe8a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Niecza/Actions.pm
Expand Up @@ -329,7 +329,7 @@ sub term__S_value { my ($cl, $M) = @_;

sub term__S_identifier { my ($cl, $M) = @_;
my $id = $M->{identifier}{_ast};
my $sal = $M->{args}{_ast};
my $sal = $M->{args}{_ast} // []; # TODO: support zero-D slicels

if (@$sal > 1) {
$M->sorry("Slicel lists are NYI");
Expand Down Expand Up @@ -924,7 +924,7 @@ sub semiarglist { my ($cl, $M) = @_;
}

sub args { my ($cl, $M) = @_;
if ($M->{semiarglist} && $M->{arglist}[0]) {
if ($M->{moreargs} || $M->{semiarglist} && $M->{arglist}[0]) {
$M->sorry("Interaction between semiargs and args is not understood");
return;
}
Expand Down
7 changes: 6 additions & 1 deletion test.pl
Expand Up @@ -10,7 +10,7 @@ ($num)
say ("1.." ~ $num);
}

plan 19;
plan 20;

ok 1, "one is true";
ok 2, "two is also true";
Expand Down Expand Up @@ -80,3 +80,8 @@ ($num)
}

ok PRE-INIT { 1 }, "preinit blocks can return values";

{
sub foo() { 42 }
ok (foo) == 42, "can call argless function without parens";
}

0 comments on commit f5fe8a4

Please sign in to comment.