File tree 2 files changed +22
-2
lines changed
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -4075,8 +4075,10 @@ var JSHINT = (function() {
4075
4075
warning ( "W104" , state . tokens . next , "object short notation" , "6" ) ;
4076
4076
}
4077
4077
t = expression ( context , 10 ) ;
4078
- i = t . value ;
4079
- saveProperty ( props , i , t ) ;
4078
+ i = t && t . value ;
4079
+ if ( t ) {
4080
+ saveProperty ( props , i , t ) ;
4081
+ }
4080
4082
4081
4083
} else if ( peek ( ) . id !== ":" && ( nextVal === "get" || nextVal === "set" ) ) {
4082
4084
advance ( nextVal ) ;
Original file line number Diff line number Diff line change @@ -10647,3 +10647,21 @@ exports.loneNullishCoalescing = function (test) {
10647
10647
10648
10648
test . done ( ) ;
10649
10649
} ;
10650
+
10651
+ // gh-3571: "Cannot read properties of undefined at Object.e.nud"
10652
+ exports . keywordAsShorthandObjectProperty = function ( test ) {
10653
+ TestRun ( test , "as reported" )
10654
+ . addError ( 1 , 12 , "Expected an identifier and instead saw 'do'." )
10655
+ . addError ( 1 , 15 , "Missing semicolon." )
10656
+ . test ( "const a = {do}" , { esversion : 6 } ) ;
10657
+
10658
+ TestRun ( test , "simplified" )
10659
+ . addError ( 1 , 7 , "Expected an identifier and instead saw 'do'." )
10660
+ . test ( "void {do};" , { esversion : 6 } ) ;
10661
+
10662
+ TestRun ( test , "alternate - penultimate member" )
10663
+ . addError ( 1 , 7 , "Expected an identifier and instead saw 'for'." )
10664
+ . test ( "void {for, baz};" , { esversion : 6 } ) ;
10665
+
10666
+ test . done ( ) ;
10667
+ } ;
You can’t perform that action at this time.
0 commit comments