File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,9 @@ module.exports = {
356
356
let right ;
357
357
if ( this . next ( ) . token == "&" ) {
358
358
if ( this . next ( ) . token === this . tok . T_NEW ) {
359
+ if ( this . php7 ) {
360
+ this . error ( ) ;
361
+ }
359
362
right = this . read_new_expr ( ) ;
360
363
} else {
361
364
right = this . read_variable ( false , false , true ) ;
Original file line number Diff line number Diff line change 1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
+ exports [` new #348 - byref usage deprecated 1` ] = `
4
+ Program {
5
+ " children" : Array [
6
+ ExpressionStatement {
7
+ " expression" : Assign {
8
+ " kind" : " assign" ,
9
+ " left" : Variable {
10
+ " byref" : false ,
11
+ " curly" : false ,
12
+ " kind" : " variable" ,
13
+ " name" : " a" ,
14
+ },
15
+ " operator" : " =" ,
16
+ " right" : New {
17
+ " arguments" : Array [],
18
+ " kind" : " new" ,
19
+ " what" : ClassReference {
20
+ " kind" : " classreference" ,
21
+ " name" : " Foo" ,
22
+ " resolution" : " uqn" ,
23
+ },
24
+ },
25
+ },
26
+ " kind" : " expressionstatement" ,
27
+ },
28
+ ],
29
+ " errors" : Array [
30
+ Error {
31
+ " expected" : undefined ,
32
+ " kind" : " error" ,
33
+ " line" : 1 ,
34
+ " message" : " Parse Error : syntax error, unexpected 'new' (T_NEW) on line 1" ,
35
+ " token" : " 'new' (T_NEW)" ,
36
+ },
37
+ ],
38
+ " kind" : " program" ,
39
+ }
40
+ ` ;
41
+
3
42
exports [` new anonymous 1` ] = `
4
43
Program {
5
44
" children" : Array [
Original file line number Diff line number Diff line change 1
1
const parser = require ( '../main' ) ;
2
2
3
3
describe ( "new" , function ( ) {
4
+ it ( "#348 - byref usage deprecated" , function ( ) {
5
+ expect ( parser . parseEval ( '$a =& new Foo();' , {
6
+ parser : {
7
+ suppressErrors : true
8
+ }
9
+ } ) ) . toMatchSnapshot ( ) ;
10
+ } ) ;
4
11
it ( "simple" , function ( ) {
5
12
expect ( parser . parseEval ( 'new Foo();' ) ) . toMatchSnapshot ( ) ;
6
- } ) ;
13
+ } ) ;
7
14
it ( "variable" , function ( ) {
8
15
expect ( parser . parseEval ( 'new $var;' ) ) . toMatchSnapshot ( ) ;
9
16
} ) ;
You can’t perform that action at this time.
0 commit comments