Skip to content

Commit

Permalink
fix non-ArgOrder op with no outputs and some OtherParsDefaults
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Oct 8, 2024
1 parent dce1978 commit cf51408
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Basic/Gen/PP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ EOD
my $svdecls = join '', map "\n $_",
(map "SV *${_}_SV = ".(
!$name2cnts{$_} ? 'NULL' :
$argorder ? "items > $name2cnts{$_}[1] ? ST($name2cnts{$_}[1]) : ".($other_out{$_} ? "sv_newmortal()" : "NULL") :
($argorder || (defined $otherdefaults->{$_} && !$nout)) ? "items > $name2cnts{$_}[1] ? ST($name2cnts{$_}[1]) : ".($other_out{$_} ? "sv_newmortal()" : "NULL") :
$name2cnts{$_}[0] == ($name2cnts{$_}[1]//-1) ? "ST($name2cnts{$_}[0])" :
"(items == $nmaxonstack) ? ST($name2cnts{$_}[0]) : ".
(!defined $name2cnts{$_}[1] ? ($other_out{$_} ? "sv_newmortal()" : "NULL") :
Expand Down
10 changes: 7 additions & 3 deletions t/01-pptest.t
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,11 @@ pp_def('logadd',
);
pp_def('ftr',
Pars => 'a(); [o]b()',
Pars => 'a()',
GenericTypes => ['F'],
Code => ';',
OtherPars => 'char* filename; int Loops; int Delay',
OtherParsDefaults => {Loops=>0, Delay=>4},
Code => 'sv_setiv(perl_get_sv("main::DelayVAL",TRUE), $COMP(Delay));',
FtrCode => " sv_setiv(perl_get_sv(\"main::FOOTERVAL\",TRUE), 1);\n",
);
Expand Down Expand Up @@ -564,8 +566,10 @@ eval { ldouble(4)->logadd(3) };
is $@, '';
undef $main::FOOTERVAL;
ftr(1);
undef $main::DelayVAL;
ftr(1, "file");
is $main::FOOTERVAL, 1;
is $main::DelayVAL, 4;
undef $main::HEADERVAL;
undef $main::FOOTERVAL;
Expand Down

0 comments on commit cf51408

Please sign in to comment.