This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Avoid extra sv_setpv for foo <newline> =>
When parsing something like
time
=>
if there is a global override, the parser transforms ‘time’ into
‘CORE::GLOBAL::time’ before it looks at the next line to see if there
is a fat arrow.
If it finds a fat arrow, it has to set the name back to ‘time’.
After finding a fat arrow on the line following a bareword, it was
setting the name to what appears in the program source, even when
there was no global override. We can skip that most of the time.
All that I said about global overrides applies to ‘our’ subs, too.
‘foo’ gets transformed into ‘ThatPackage::foo’ and needs to be changed
back. I added a test, to make sure that is not accidentally broken.
I took the liberty of changing ((SVOP*)pl_yylval.opval)->op_sv to sv
at the same time, to make the code more readable.