File tree 3 files changed +56
-53
lines changed
test/snapshot/__snapshots__
3 files changed +56
-53
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ module.exports = {
221
221
text
222
222
) ;
223
223
} else if ( this . token === this . tok . T_DOLLAR_OPEN_CURLY_BRACES ) {
224
- syntax = ' simple' ;
224
+ syntax = " simple" ;
225
225
curly = true ;
226
226
// dynamic variable name
227
227
// https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1239
@@ -237,24 +237,23 @@ module.exports = {
237
237
node = this . node ( "offsetlookup" ) ;
238
238
offset = this . next ( ) . read_expr ( ) ;
239
239
this . expect ( "]" ) && this . next ( ) ;
240
- name = node ( name , offset ) ;
240
+ result = node ( name , offset ) ;
241
241
} else {
242
- name = varName ;
242
+ result = name ( varName , false ) ;
243
243
}
244
244
} else {
245
- name = this . read_expr ( ) ;
245
+ result = result ( "variable" , this . read_expr ( ) , false ) ;
246
246
}
247
247
this . expect ( "}" ) && this . next ( ) ;
248
- result = result ( "variable" , name ) ;
249
248
} else if ( this . token === this . tok . T_CURLY_OPEN ) {
250
249
// expression
251
250
// https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1246
252
- syntax = ' complex' ;
251
+ syntax = " complex" ;
253
252
result . destroy ( ) ;
254
253
result = this . next ( ) . read_variable ( false , false ) ;
255
254
this . expect ( "}" ) && this . next ( ) ;
256
255
} else if ( this . token === this . tok . T_VARIABLE ) {
257
- syntax = ' simple' ;
256
+ syntax = " simple" ;
258
257
// plain variable
259
258
// https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1231
260
259
result . destroy ( ) ;
Original file line number Diff line number Diff line change @@ -193,7 +193,11 @@ Program {
193
193
" expression" : Variable {
194
194
" curly" : false ,
195
195
" kind" : " variable" ,
196
- " name" : " juice" ,
196
+ " name" : Variable {
197
+ " curly" : false ,
198
+ " kind" : " variable" ,
199
+ " name" : " juice" ,
200
+ },
197
201
},
198
202
" kind" : " encapsedpart" ,
199
203
" syntax" : " simple" ,
@@ -244,12 +248,16 @@ Program {
244
248
EncapsedPart {
245
249
" curly" : true ,
246
250
" expression" : Variable {
247
- " curly" : true ,
251
+ " curly" : false ,
248
252
" kind" : " variable" ,
249
253
" name" : Variable {
250
- " curly" : false ,
254
+ " curly" : true ,
251
255
" kind" : " variable" ,
252
- " name" : " juice" ,
256
+ " name" : Variable {
257
+ " curly" : false ,
258
+ " kind" : " variable" ,
259
+ " name" : " juice" ,
260
+ },
253
261
},
254
262
},
255
263
" kind" : " encapsedpart" ,
@@ -300,13 +308,17 @@ Program {
300
308
},
301
309
EncapsedPart {
302
310
" curly" : true ,
303
- " expression" : Call {
304
- " arguments" : Array [],
305
- " kind" : " call" ,
306
- " what" : ClassReference {
307
- " kind" : " classreference" ,
308
- " name" : " call" ,
309
- " resolution" : " uqn" ,
311
+ " expression" : Variable {
312
+ " curly" : false ,
313
+ " kind" : " variable" ,
314
+ " name" : Call {
315
+ " arguments" : Array [],
316
+ " kind" : " call" ,
317
+ " what" : ClassReference {
318
+ " kind" : " classreference" ,
319
+ " name" : " call" ,
320
+ " resolution" : " uqn" ,
321
+ },
310
322
},
311
323
},
312
324
" kind" : " encapsedpart" ,
@@ -604,9 +616,9 @@ Program {
604
616
EncapsedPart {
605
617
" curly" : true ,
606
618
" expression" : Variable {
607
- " curly" : " juice " ,
619
+ " curly" : false ,
608
620
" kind" : " variable" ,
609
- " name" : " variable " ,
621
+ " name" : " juice " ,
610
622
},
611
623
" kind" : " encapsedpart" ,
612
624
" syntax" : " simple" ,
@@ -2854,9 +2866,9 @@ Program {
2854
2866
EncapsedPart {
2855
2867
" curly" : true ,
2856
2868
" expression" : Variable {
2857
- " curly" : " var " ,
2869
+ " curly" : false ,
2858
2870
" kind" : " variable" ,
2859
- " name" : " variable " ,
2871
+ " name" : " var " ,
2860
2872
},
2861
2873
" kind" : " encapsedpart" ,
2862
2874
" syntax" : " simple" ,
Original file line number Diff line number Diff line change @@ -1662,23 +1662,19 @@ Program {
1662
1662
},
1663
1663
EncapsedPart {
1664
1664
" curly" : true ,
1665
- " expression" : Variable {
1666
- " curly" : false ,
1667
- " kind" : " variable" ,
1668
- " name" : OffsetLookup {
1669
- " kind" : " offsetlookup" ,
1670
- " offset" : String {
1671
- " isDoubleQuote" : false ,
1672
- " kind" : " string" ,
1673
- " raw" : " 'FOO'" ,
1674
- " unicode" : false ,
1675
- " value" : " FOO" ,
1676
- },
1677
- " what" : Variable {
1678
- " curly" : false ,
1679
- " kind" : " variable" ,
1680
- " name" : " juices" ,
1681
- },
1665
+ " expression" : OffsetLookup {
1666
+ " kind" : " offsetlookup" ,
1667
+ " offset" : String {
1668
+ " isDoubleQuote" : false ,
1669
+ " kind" : " string" ,
1670
+ " raw" : " 'FOO'" ,
1671
+ " unicode" : false ,
1672
+ " value" : " FOO" ,
1673
+ },
1674
+ " what" : Variable {
1675
+ " curly" : false ,
1676
+ " kind" : " variable" ,
1677
+ " name" : " juices" ,
1682
1678
},
1683
1679
},
1684
1680
" kind" : " encapsedpart" ,
@@ -2866,20 +2862,16 @@ EOFX",
2866
2862
},
2867
2863
EncapsedPart {
2868
2864
" curly" : true ,
2869
- " expression" : Variable {
2870
- " curly" : false ,
2871
- " kind" : " variable" ,
2872
- " name" : OffsetLookup {
2873
- " kind" : " offsetlookup" ,
2874
- " offset" : Number {
2875
- " kind" : " number" ,
2876
- " value" : " 1" ,
2877
- },
2878
- " what" : Variable {
2879
- " curly" : false ,
2880
- " kind" : " variable" ,
2881
- " name" : " targetDirs" ,
2882
- },
2865
+ " expression" : OffsetLookup {
2866
+ " kind" : " offsetlookup" ,
2867
+ " offset" : Number {
2868
+ " kind" : " number" ,
2869
+ " value" : " 1" ,
2870
+ },
2871
+ " what" : Variable {
2872
+ " curly" : false ,
2873
+ " kind" : " variable" ,
2874
+ " name" : " targetDirs" ,
2883
2875
},
2884
2876
},
2885
2877
" kind" : " encapsedpart" ,
You can’t perform that action at this time.
0 commit comments