MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This commit makes B::Deparse support code like ‘our $ḟōō’. Currently,
an ‘our’ variable whose name is an octet sequence that does not consist
of (\w|::)+ can only be a UTF8 variable name.
When the pad is made to support UTF8 properly, this may need to
be changed.
and not $self->{'avoid_local'}{$$op}) {
my $our_local = ($op->private & OPpLVAL_INTRO) ? "local" : "our";
if( $our_local eq 'our' ) {
- # XXX This assertion fails code with non-ASCII identifiers,
- # like ./ext/Encode/t/jperl.t
- die "Unexpected our($text)\n" unless $text =~ /^\W(\w+::)*\w+\z/;
+ if ( $text !~ /^\W(\w+::)*\w+\z/
+ and !utf8::decode($text) || $text !~ /^\W(\w+::)*\w+\z/
+ ) {
+ die "Unexpected our($text)\n";
+ }
$text =~ s/(\w+::)+//;
}
if (want_scalar($op)) {
require feature;
feature->import(':5.10');
}
-use Test::More tests => 90;
+use Test::More tests => 91;
use Config ();
use B::Deparse;
1
EOFCODE
+# [perl #33752]
+{
+ my $code = <<"EOCODE";
+{
+ our \$\x{1e1f}\x{14d}\x{14d};
+}
+EOCODE
+ my $deparsed
+ = $deparse->coderef2text(eval "sub { our \$\x{1e1f}\x{14d}\x{14d} }" );
+ s/$ \n//x for $deparsed, $code;
+ is $deparsed, $code, 'our $funny_Unicode_chars';
+}
+
__DATA__
# 2
1;