Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Perl/perl5] 74a044: add OPpCONST_LINE flag to aid deparsing

1 view
Skip to first unread message

iabyn via perl5-changes

unread,
Feb 19, 2024, 6:30:03 AM2/19/24
to perl5-...@perl.org
Branch: refs/heads/davem/line
Home: https://github.com/Perl/perl5
Commit: 74a04465d47440e72b5b577d331a741a2c313461
https://github.com/Perl/perl5/commit/74a04465d47440e72b5b577d331a741a2c313461
Author: David Mitchell <da...@iabyn.com>
Date: 2024-02-19 (Mon, 19 Feb 2024)

Changed paths:
M Porting/deparse-skips.txt
M lib/B/Deparse.pm
M lib/B/Deparse.t
M lib/B/Op_private.pm
M opcode.h
M regen/op_private
M toke.c

Log Message:
-----------
add OPpCONST_LINE flag to aid deparsing

Code like

my $line = __LINE__;

was being deparsed as

my $line = '42';

because __LINE__ is converted by the lexer into an ordinary OP_CONST
whose SV is just a plain string holding the line number.

This commit adds a flag, OPpCONST_LINE, to OP_CONST, which is set to
indicate that this OP_CONST was created from a __LINE__ construct.

Deparse.pm then uses this new flag to print out the literal string
"__LINE__" rather than the constant's actual value.

This fixes one failing test file under
cd t; ./TEST -deparse
and removes one (but not all) sources of failure from three others.



To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications
0 new messages