summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2019-01-02 11:20:34 +1100
committerTony Cook <tony@develop-help.com>2019-01-02 11:20:34 +1100
commit7122d783e33c1d4b9b5a037eef231fae4c2d76cd (patch)
treeae8643c2b9fc7e51d4fa91c1cf22db3083db5b8e
parent76dacd2ed6a27ae362c4ea85efa696977916a58f (diff)
downloadperl-7122d783e33c1d4b9b5a037eef231fae4c2d76cd.tar.gz
[perl #133524] report line number for Prototype not terminated
Previously COPLINE was updated (to the end of the file) before reporting the error, which wasn't useful.
-rw-r--r--t/lib/croak/toke6
-rw-r--r--toke.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/t/lib/croak/toke b/t/lib/croak/toke
index 4a01c7adab..59c377ba6b 100644
--- a/t/lib/croak/toke
+++ b/t/lib/croak/toke
@@ -487,3 +487,9 @@ dump;
CORE::dump;
EXPECT
dump() must be written as CORE::dump() as of Perl 5.30 at - line 2.
+########
+# NAME check Prototype not terminated includes line number (133524)
+sub t1 {}
+sub t2 (}
+EXPECT
+Prototype not terminated at - line 2.
diff --git a/toke.c b/toke.c
index 0527bd810a..844de04a23 100644
--- a/toke.c
+++ b/toke.c
@@ -8738,9 +8738,9 @@ Perl_yylex(pTHX)
/* Look for a prototype */
if (*s == '(' && !is_sigsub) {
s = scan_str(s,FALSE,FALSE,FALSE,NULL);
- COPLINE_SET_FROM_MULTI_END;
if (!s)
Perl_croak(aTHX_ "Prototype not terminated");
+ COPLINE_SET_FROM_MULTI_END;
(void)validate_proto(PL_subname, PL_lex_stuff,
ckWARN(WARN_ILLEGALPROTO), 0);
have_proto = TRUE;