diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-10-22 19:32:04 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-22 19:50:48 -0700 |
commit | 51a82aa9fb28c58b85d2a2e89872685010ffa91c (patch) | |
tree | 00c03bdebe06be0dc6f64a95ca117e2995e0d00f /t/op/runlevel.t | |
parent | 551992550541be7bd63c953d9a52701192115a6c (diff) | |
download | perl-51a82aa9fb28c58b85d2a2e89872685010ffa91c.tar.gz |
[perl #122695] Fix line number for else{foo}
where there is no space after the opening brace.
The code that was responsible for the wrong line number:
if (isSPACE(*s) || *s == '#')
PL_copline = NOLINE; /* invalidate current command line number */
was added in perl *2.0* (378cc40b3)! It looked a little different
back then:
if (isspace(*s) || *s == '#')
cmdline = NOLINE; /* invalidate current command line number */
I don’t know what the condition was for. I can only imagine that it
seemed logical to skip the setting of cmdline if it appeared to be
something on the same line (e.g., if($foo){bar()} as opposed to
if($foo){<newline>...}). Clearly that doesn’t work for ‘else{foo()}’
because we end up giving that statement the line number where the
‘if’ occurs. (cmdline/PL_copline is for remembering the first line of
a multi-line construct.)
Diffstat (limited to 't/op/runlevel.t')
-rw-r--r-- | t/op/runlevel.t | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/op/runlevel.t b/t/op/runlevel.t index 3e68a2361a..5b6b39fa37 100644 --- a/t/op/runlevel.t +++ b/t/op/runlevel.t @@ -169,7 +169,7 @@ foo: @a = sort { last foo; } @a; } EXPECT -Label not found for "last foo" at - line 2. +Label not found for "last foo" at - line 4. ######## package TEST; |