File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -238,7 +238,8 @@ module.exports = {
238238 this . _input [ this . offset ] === "-" &&
239239 this . _input [ this . offset + 1 ] === ">"
240240 ) {
241- this . consume ( 2 ) ;
241+ this . consume ( 1 ) ;
242+ this . begin ( "ST_LOOKING_FOR_PROPERTY" ) . input ( ) ;
242243 return this . tok . T_NULLSAFE_OBJECT_OPERATOR ;
243244 }
244245 return "?" ;
Original file line number Diff line number Diff line change @@ -125,6 +125,30 @@ exports[`Test lexer test #148 - sensitive lexer 1`] = `
125125]
126126` ;
127127
128+ exports [` Test lexer test #1003 - null-safe operator with reserved keyword 1` ] = `
129+ Program {
130+ " children" : [
131+ ExpressionStatement {
132+ " expression" : NullSafePropertyLookup {
133+ " kind" : " nullsafepropertylookup" ,
134+ " offset" : Identifier {
135+ " kind" : " identifier" ,
136+ " name" : " class" ,
137+ },
138+ " what" : Variable {
139+ " curly" : false ,
140+ " kind" : " variable" ,
141+ " name" : " a" ,
142+ },
143+ },
144+ " kind" : " expressionstatement" ,
145+ },
146+ ],
147+ " errors" : [],
148+ " kind" : " program" ,
149+ }
150+ ` ;
151+
128152exports [` Test lexer test comments 1` ] = `
129153Program {
130154 " children" : [
Original file line number Diff line number Diff line change @@ -81,4 +81,8 @@ describe("Test lexer", function () {
8181 it ( "test #148 - sensitive lexer" , function ( ) {
8282 expect ( parser . tokenGetAll ( "<?php $this-> list;" ) ) . toMatchSnapshot ( ) ;
8383 } ) ;
84+
85+ it ( "test #1003 - null-safe operator with reserved keyword" , function ( ) {
86+ expect ( parser . parseCode ( "<?php $a?->class;" ) ) . toMatchSnapshot ( ) ;
87+ } ) ;
8488} ) ;
You can’t perform that action at this time.
0 commit comments