File tree 3 files changed +30
-5
lines changed
3 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 1
1
# Releases
2
2
3
+ ## 2.1.0 : pending
4
+
5
+ - Fix AST errors on suppressErrors
6
+
3
7
## 2.0.0 : (2017-03-04)
4
8
5
9
- Update AST for operators, unify bin/bool/coalesce nodes
Original file line number Diff line number Diff line change @@ -184,11 +184,13 @@ module.exports = {
184
184
if ( this . token !== ')' ) {
185
185
while ( this . token != this . EOF ) {
186
186
var argument = this . read_argument_list ( ) ;
187
- result . push ( argument ) ;
188
- if ( argument . kind === 'variadic' ) {
189
- wasVariadic = true ;
190
- } else if ( wasVariadic ) {
191
- this . raiseError ( 'Unexpected argument after a variadic argument' ) ;
187
+ if ( argument ) {
188
+ result . push ( argument ) ;
189
+ if ( argument . kind === 'variadic' ) {
190
+ wasVariadic = true ;
191
+ } else if ( wasVariadic ) {
192
+ this . raiseError ( 'Unexpected argument after a variadic argument' ) ;
193
+ }
192
194
}
193
195
if ( this . token === ',' ) {
194
196
this . next ( ) ;
Original file line number Diff line number Diff line change @@ -70,6 +70,25 @@ describe('Test graceful mode', function() {
70
70
ast . children [ 0 ] . kind . should . be . exactly ( 'interface' ) ;
71
71
} ) ;
72
72
73
+ it ( 'test function arguments' , function ( ) {
74
+ // test.parser.debug = true;
75
+ var ast = test . parseEval ( [
76
+ '$foo->bar($arg, );' ,
77
+ '$foo = new bar($baz, ,$foo);'
78
+ ] . join ( '\n' ) ) ;
79
+ var callNode = ast . children [ 0 ] ;
80
+ callNode . kind . should . be . exactly ( 'call' ) ;
81
+ callNode . what . kind . should . be . exactly ( 'propertylookup' ) ;
82
+ callNode . arguments . length . should . be . exactly ( 1 ) ;
83
+ callNode . arguments [ 0 ] . name . should . be . exactly ( 'arg' ) ;
84
+ var assignNode = ast . children [ 1 ] ;
85
+ assignNode . kind . should . be . exactly ( 'assign' ) ;
86
+ assignNode . right . kind . should . be . exactly ( 'new' ) ;
87
+ assignNode . right . arguments [ 0 ] . name . should . be . exactly ( 'baz' ) ;
88
+ // the supressError mode cant guarantee $foo to be included into the arguments list
89
+ } ) ;
90
+
91
+
73
92
} ) ;
74
93
75
94
} ) ;
You can’t perform that action at this time.
0 commit comments