@@ -418,14 +418,16 @@ pp.parseExpressionStatement = function(node, expr) {
418
418
// strict"` declarations when `allowStrict` is true (used for
419
419
// function bodies).
420
420
421
- pp . parseBlock = function ( createNewLexicalScope = true , node = this . startNode ( ) ) {
421
+ pp . parseBlock = function ( createNewLexicalScope = true , node = this . startNode ( ) , exitStrict ) {
422
422
node . body = [ ]
423
423
this . expect ( tt . braceL )
424
424
if ( createNewLexicalScope ) this . enterScope ( 0 )
425
- while ( ! this . eat ( tt . braceR ) ) {
425
+ while ( this . type !== tt . braceR ) {
426
426
let stmt = this . parseStatement ( null )
427
427
node . body . push ( stmt )
428
428
}
429
+ if ( exitStrict ) this . strict = false
430
+ this . next ( )
429
431
if ( createNewLexicalScope ) this . exitScope ( )
430
432
return this . finishNode ( node , "BlockStatement" )
431
433
}
@@ -578,7 +580,7 @@ pp.parseClass = function(node, isStatement) {
578
580
let hadConstructor = false
579
581
classBody . body = [ ]
580
582
this . expect ( tt . braceL )
581
- while ( ! this . eat ( tt . braceR ) ) {
583
+ while ( this . type !== tt . braceR ) {
582
584
const element = this . parseClassElement ( node . superClass !== null )
583
585
if ( element ) {
584
586
classBody . body . push ( element )
@@ -588,8 +590,9 @@ pp.parseClass = function(node, isStatement) {
588
590
}
589
591
}
590
592
}
591
- node . body = this . finishNode ( classBody , "ClassBody" )
592
593
this . strict = oldStrict
594
+ this . next ( )
595
+ node . body = this . finishNode ( classBody , "ClassBody" )
593
596
return this . finishNode ( node , isStatement ? "ClassDeclaration" : "ClassExpression" )
594
597
}
595
598
0 commit comments