From: Father Chrysostomos Date: Tue, 5 Jun 2007 13:25:39 +0000 (-0700) Subject: Re: [perl #43082] "$_[0]->method" interpolation X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=02255c606d03ddedf1941776619d3260891f7b92;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #43082] "$_[0]->method" interpolation Message-Id: <064E3238-D26D-446D-9B7E-0DB8CEFDE0AD@cpan.org> p4raw-id: //depot/perl@31351 --- diff --git a/t/comp/parser.t b/t/comp/parser.t index 0d2f4d6..2e23226 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -9,7 +9,7 @@ BEGIN { } BEGIN { require "./test.pl"; } -plan( tests => 108 ); +plan( tests => 110 ); eval '%@x=0;'; like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' ); @@ -351,5 +351,15 @@ eval <<'EOSTANZA'; die $@ if $@; 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 diff --git a/toke.c b/toke.c index a375a77..b2b6ba1 100644 --- a/toke.c +++ b/toke.c @@ -4390,7 +4390,9 @@ Perl_yylex(pTHX) --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; } }