[perl #114658] Fix line numbers at the end of string eval
authorFather Chrysostomos <sprout@cpan.org>
Wed, 10 Oct 2012 20:14:31 +0000 (13:14 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 10 Oct 2012 20:15:14 +0000 (13:15 -0700)
commit451f421fe4742646fa2efbed0f45a19f0713d00f
tree7d78530b99142d67abb214536f34b6a944658656
parent73f2c082cce3e45af05f993af5e9294bb30e6ee5
[perl #114658] Fix line numbers at the end of string eval

$ perl -e 'eval "{;"; print $@'
Missing right curly or square bracket at (eval 1) line 1, at end of line
syntax error at (eval 1) line 1, at EOF
$ perl -e 'eval "{"; print $@'
Missing right curly or square bracket at (eval 1) line 2, at end of line
syntax error at (eval 1) line 2, at EOF

Notice how the line number goes up when there is no semicolon.

What happens is that eval tacks "\n;" on to the end of the string if
it does not already end with a semicolon.

I actually changed this in blead in commit 11076590 to tack "\n;"
on to the end all the time, to make eval "q;;" and
eval "return #comment;" work.

This caused the line number to increase for eval "{;".

This commit fixes both examples above by modifying S_incline to
account for the "\n;" at the end of a string eval.

Existing tests had to be modified, as they were testing for the wrong
line number.
t/lib/warnings/pad
t/op/eval.t
toke.c