File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -2451,7 +2451,9 @@ var JSHINT = (function() {
2451
2451
that . left = left ;
2452
2452
var right = that . right = expression ( context , 39 ) ;
2453
2453
2454
- if ( ! right . paren && ( right . id === "||" || right . id === "&&" ) ) {
2454
+ if ( ! right ) {
2455
+ error ( "E024" , state . tokens . next , state . tokens . next . id ) ;
2456
+ } else if ( ! right . paren && ( right . id === "||" || right . id === "&&" ) ) {
2455
2457
error ( "E024" , that . right , that . right . id ) ;
2456
2458
}
2457
2459
Original file line number Diff line number Diff line change @@ -10624,3 +10624,26 @@ exports.loneNew = function (test) {
10624
10624
10625
10625
test . done ( ) ;
10626
10626
} ;
10627
+
10628
+ // gh-3560: "Logical nullish assignment (??=) throwing error"
10629
+ exports . loneNullishCoalescing = function ( test ) {
10630
+ TestRun ( test , "as reported" )
10631
+ . addError ( 2 , 8 , "Expected an identifier and instead saw '='." )
10632
+ . addError ( 2 , 10 , "Unexpected '(number)'." )
10633
+ . addError ( 2 , 8 , "Expected an assignment or function call and instead saw an expression." )
10634
+ . addError ( 2 , 9 , "Missing semicolon." )
10635
+ . addError ( 2 , 10 , "Expected an assignment or function call and instead saw an expression." )
10636
+ . test ( [
10637
+ "let a = [1,2];" ,
10638
+ "a[0] ??= 0;"
10639
+ ] , { esversion : 11 } ) ;
10640
+
10641
+ TestRun ( test , "simplified" )
6146
10642
+ . addError ( 1 , 4 , "Expected an identifier and instead saw ';'." )
10643
+ . addError ( 1 , 4 , "Unexpected '(end)'." )
10644
+ . addError ( 1 , 4 , "Expected an assignment or function call and instead saw an expression." )
10645
+ . addError ( 1 , 5 , "Missing semicolon." )
10646
+ . test ( "0??;" , { esversion : 11 } ) ;
10647
+
10648
+ test . done ( ) ;
10649
+ } ;
You can’t perform that action at this time.
0 commit comments