Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix line numbers in arity errors [#121374]
  • Loading branch information
mauke authored and Father Chrysostomos committed Oct 28, 2014
1 parent df8d573 commit a2b5b20
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions toke.c
Expand Up @@ -11507,10 +11507,16 @@ Perl_parse_subsignature(pTHX)
scalar(newUNOP(OP_RV2AV, 0,
newGVOP(OP_GV, 0, PL_defgv))),
newSVOP(OP_CONST, 0, newSViv(1))),
newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0),
newSVOP(OP_CONST, 0,
newSVpvs("Odd name/value argument "
"for subroutine"))));
op_convert_list(OP_DIE, 0,
op_convert_list(OP_SPRINTF, 0,
op_append_list(OP_LIST,
newSVOP(OP_CONST, 0,
newSVpvs("Odd name/value argument for subroutine at %s line %d.\n")),
newSLICEOP(0,
op_append_list(OP_LIST,
newSVOP(OP_CONST, 0, newSViv(1)),
newSVOP(OP_CONST, 0, newSViv(2))),
newOP(OP_CALLER, 0))))));
if (pos != min_arity)
chkop = newLOGOP(OP_AND, 0,
newBINOP(OP_GT, 0,
Expand Down Expand Up @@ -11573,9 +11579,16 @@ Perl_parse_subsignature(pTHX)
scalar(newUNOP(OP_RV2AV, 0,
newGVOP(OP_GV, 0, PL_defgv))),
newSVOP(OP_CONST, 0, newSViv(min_arity))),
newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0),
newSVOP(OP_CONST, 0,
newSVpvs("Too few arguments for subroutine"))))),
op_convert_list(OP_DIE, 0,
op_convert_list(OP_SPRINTF, 0,
op_append_list(OP_LIST,
newSVOP(OP_CONST, 0,
newSVpvs("Too few arguments for subroutine at %s line %d.\n")),
newSLICEOP(0,
op_append_list(OP_LIST,
newSVOP(OP_CONST, 0, newSViv(1)),
newSVOP(OP_CONST, 0, newSViv(2))),
newOP(OP_CALLER, 0))))))),
initops);
}
if (max_arity != -1) {
Expand All @@ -11586,9 +11599,16 @@ Perl_parse_subsignature(pTHX)
scalar(newUNOP(OP_RV2AV, 0,
newGVOP(OP_GV, 0, PL_defgv))),
newSVOP(OP_CONST, 0, newSViv(max_arity))),
newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0),
newSVOP(OP_CONST, 0,
newSVpvs("Too many arguments for subroutine"))))),
op_convert_list(OP_DIE, 0,
op_convert_list(OP_SPRINTF, 0,
op_append_list(OP_LIST,
newSVOP(OP_CONST, 0,
newSVpvs("Too many arguments for subroutine at %s line %d.\n")),
newSLICEOP(0,
op_append_list(OP_LIST,
newSVOP(OP_CONST, 0, newSViv(1)),
newSVOP(OP_CONST, 0, newSViv(2))),
newOP(OP_CALLER, 0))))))),
initops);
}
return initops;
Expand Down

0 comments on commit a2b5b20

Please sign in to comment.