File tree 2 files changed +21
-6
lines changed
2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -204,7 +204,8 @@ describe('Test expressions', function() {
204
204
205
205
it ( 'test new' , function ( ) {
206
206
var ast = parser . parseEval ( [
207
- '$a = new foo();' ,
207
+ '$a = new \\foo();' ,
208
+ '$a = new namespace\\foo::class();' ,
208
209
'$a = new $foo();' ,
209
210
'$a = new class extends foo implements bar { };' ,
210
211
] . join ( '\n' ) , {
@@ -213,11 +214,11 @@ describe('Test expressions', function() {
213
214
ast . children [ 0 ] . right . kind . should . be . exactly ( 'new' ) ;
214
215
ast . children [ 0 ] . right . what . kind . should . be . exactly ( 'identifier' ) ;
215
216
216
- ast . children [ 1 ] . right . kind . should . be . exactly ( 'new' ) ;
217
- ast . children [ 1 ] . right . what . kind . should . be . exactly ( 'variable' ) ;
218
-
219
217
ast . children [ 2 ] . right . kind . should . be . exactly ( 'new' ) ;
220
- ast . children [ 2 ] . right . what . kind . should . be . exactly ( 'class' ) ;
218
+ ast . children [ 2 ] . right . what . kind . should . be . exactly ( 'variable' ) ;
219
+
220
+ ast . children [ 3 ] . right . kind . should . be . exactly ( 'new' ) ;
221
+ ast . children [ 3 ] . right . what . kind . should . be . exactly ( 'class' ) ;
221
222
} ) ;
222
223
223
224
it ( 'test nested expressions precedence' , function ( ) {
Original file line number Diff line number Diff line change @@ -10,6 +10,20 @@ describe('Test scalar statements', function() {
10
10
debug : true
11
11
}
12
12
} ) ;
13
- console . log ( ast ) ;
13
+ // @todo assert console.log(ast);
14
+
15
+ } ) ;
16
+ it ( 'dereferencable' , function ( ) {
17
+ var ast = parser . parseEval ( [
18
+ '$a = foo::bar()[5]->test;' ,
19
+ '$b = (new test())->foo();' ,
20
+ '$c = (foo())[5];' ,
21
+ '$d = (function($a) { return $a * 2; })(5);' ,
22
+ ] . join ( '\n' ) , {
23
+ parser : {
24
+ debug : true
25
+ }
26
+ } ) ;
27
+
14
28
} ) ;
15
29
} ) ;
You can’t perform that action at this time.
0 commit comments