@@ -187,7 +187,9 @@ pp.rethrowObjParseError = function(objParseResult, blockParseError) {
187187pp . parseInlineWhiteBlock = function ( node ) {
188188 if ( this . state . type . startsExpr ) return this . parseMaybeAssign ( ) ;
189189 // oneline statement case
190+ this . state . nestedBlockLevel ++ ;
190191 node . body = [ this . parseStatement ( true ) ] ;
192+ this . state . nestedBlockLevel -- ;
191193 node . directives = [ ] ;
192194 this . addExtra ( node , "curly" , false ) ;
193195 return this . finishNode ( node , "BlockStatement" ) ;
@@ -198,15 +200,20 @@ pp.parseMultilineWhiteBlock = function(node, indentLevel) {
198200 if ( this . match ( tt . braceL ) && this . hasPlugin ( "objectBlockAmbiguity_preferObject" ) ) {
199201 objParseResult = this . tryParseObjectWhiteBlock ( node , indentLevel ) ;
200202 if ( objParseResult [ 0 ] ) return objParseResult [ 0 ] ;
201- }
202203
203- try {
204+ try {
205+ this . parseBlockBody ( node , false , false , indentLevel ) ;
206+ if ( ! node . body . length ) {
207+ this . unexpected ( node . start , "Expected an Indent or Statement" ) ;
208+ }
209+ } catch ( err ) {
210+ this . rethrowObjParseError ( objParseResult , err ) ;
211+ }
212+ } else {
204213 this . parseBlockBody ( node , false , false , indentLevel ) ;
205214 if ( ! node . body . length ) {
206215 this . unexpected ( node . start , "Expected an Indent or Statement" ) ;
207216 }
208- } catch ( err ) {
209- this . rethrowObjParseError ( objParseResult , err ) ;
210217 }
211218
212219 this . addExtra ( node , "curly" , false ) ;
@@ -230,7 +237,10 @@ pp.parseWhiteBlock = function (isExpression?) {
230237 if ( objParseResult [ 0 ] ) return objParseResult [ 0 ] ;
231238 }
232239 try {
233- return this . parseStatement ( false ) ;
240+ this . state . nestedBlockLevel ++ ;
241+ const stmt = this . parseStatement ( false ) ;
242+ this . state . nestedBlockLevel -- ;
243+ return stmt ;
234244 } catch ( err ) {
235245 this . rethrowObjParseError ( objParseResult , err ) ;
236246 }
0 commit comments