Change 31351 by [EMAIL PROTECTED] on 2007/06/07 14:05:11
Subject: Re: [perl #43082] "$_[0]->method" interpolation
From: Father Chrysostomos <[EMAIL PROTECTED]>
Date: Tue, 5 Jun 2007 13:25:39 -0700
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/t/comp/parser.t#30 edit
... //depot/perl/toke.c#786 edit
Differences ...
==== //depot/perl/t/comp/parser.t#30 (text) ====
Index: perl/t/comp/parser.t
--- perl/t/comp/parser.t#29~30229~ 2007-02-12 07:31:56.000000000 -0800
+++ perl/t/comp/parser.t 2007-06-07 07:05:11.000000000 -0700
@@ -9,7 +9,7 @@
}
BEGIN { require "./test.pl"; }
-plan( tests => 108 );
+plan( tests => 110 );
eval '[EMAIL PROTECTED];';
like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '[EMAIL
PROTECTED]' );
@@ -351,5 +351,15 @@
check(qr/^Great hail!.*no more\.$/, 61, "Overflow both small buffer checks");
EOSTANZA
+{
+ my @x = 'string';
+ is(eval q{ "$x[0]->strung" }, 'string->strung',
+ 'literal -> after an array subscript within ""');
+ @x = ['string'];
+ # this used to give "string"
+ like("$x[0]-> [0]", qr/^ARRAY\([^)]*\)-> \[0]\z/,
+ 'literal -> [0] after an array subscript within ""');
+}
+
__END__
# Don't add new tests HERE. See note above
==== //depot/perl/toke.c#786 (text) ====
Index: perl/toke.c
--- perl/toke.c#785~31333~ 2007-06-05 03:10:33.000000000 -0700
+++ perl/toke.c 2007-06-07 07:05:11.000000000 -0700
@@ -4390,7 +4390,9 @@
--PL_lex_brackets;
if (PL_lex_state == LEX_INTERPNORMAL) {
if (PL_lex_brackets == 0) {
- if (*s != '[' && *s != '{' && (*s != '-' || s[1] != '>'))
+ if (*s == '-' && s[1] == '>')
+ PL_lex_state = LEX_INTERPENDMAYBE;
+ else if (*s != '[' && *s != '{')
PL_lex_state = LEX_INTERPEND;
}
}
End of Patch.