File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4075,8 +4075,10 @@ var JSHINT = (function() {
40754075 warning ( "W104" , state . tokens . next , "object short notation" , "6" ) ;
40764076 }
40774077 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+ }
40804082
40814083 } else if ( peek ( ) . id !== ":" && ( nextVal === "get" || nextVal === "set" ) ) {
40824084 advance ( nextVal ) ;
Original file line number Diff line number Diff line change @@ -10647,3 +10647,21 @@ exports.loneNullishCoalescing = function (test) {
1064710647
1064810648 test . done ( ) ;
1064910649} ;
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