diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-10-28 16:52:18 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-28 17:46:59 -0700 |
commit | e660c409f22c1a7f1be06f3ef5168a7a09a5835a (patch) | |
tree | 53e98177dd87a5996024c8039f9c4b057677eef6 /lib/vars_carp.t | |
parent | 00e40766a52e90fea69000c44dbc74c62133f696 (diff) | |
download | perl-e660c409f22c1a7f1be06f3ef5168a7a09a5835a.tar.gz |
[perl #122782] map{no strict;...} etc.
After the lexer (toke.c) has decided in the case of ‘map{’ or ‘print{’
that it has a block, not a hash constructor, it has then preceded to
treat the contents as an expression.
Since it is the parser (perly.y) that ultimately decides whether it is
an expression or statement, most of the time things just work. But in
those cases where the lexer behaves differently whether it is expect-
ing a statement or expression, it usually just does the wrong thing.
Most notable is map {no strict;...}, which dies with ‘"no" not
allowed in expression’. See the RT ticket for more examples of the
term/statement discrepancies.
This commit changes it to expect a statement most of the time. These
changes also apply to the contents of ${...}, which has always fol-
lowed the same rules. Two cases where it used simply to dwim that
would break with a statement expectation are special-cased, to pre-
serve backward-compatibility as much as possible. See the comments
added to toke. We already have an exception for ‘sub’ in the case of
${sub{...}}, which is not treated as $sub{...} as happens with other
barewords, so this is consistent with that.
Diffstat (limited to 'lib/vars_carp.t')
0 files changed, 0 insertions, 0 deletions