@@ -6337,24 +6337,34 @@ func (p *Parser) isUsingDeclaration() bool {
6337
6337
// 'using' always starts a lexical declaration if followed by an identifier. We also eagerly parse
6338
6338
// |ObjectBindingPattern| so that we can report a grammar error during check. We don't parse out
6339
6339
// |ArrayBindingPattern| since it potentially conflicts with element access (i.e., `using[x]`).
6340
- return p .lookAhead ((* Parser ).nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine )
6340
+ return p .lookAhead (func (p * Parser ) bool {
6341
+ return p .nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine ( /*disallowOf*/ false )
6342
+ })
6341
6343
}
6342
6344
6343
- func (p * Parser ) nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine () bool {
6345
+ func (p * Parser ) nextTokenIsEqualsOrSemicolonOrColonToken () bool {
6344
6346
p .nextToken ()
6347
+ return p .token == ast .KindEqualsToken || p .token == ast .KindSemicolonToken || p .token == ast .KindColonToken
6348
+ }
6349
+
6350
+ func (p * Parser ) nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine (disallowOf bool ) bool {
6351
+ p .nextToken ()
6352
+ if disallowOf && p .token == ast .KindOfKeyword {
6353
+ return p .lookAhead ((* Parser ).nextTokenIsEqualsOrSemicolonOrColonToken )
6354
+ }
6345
6355
return p .isBindingIdentifier () || p .token == ast .KindOpenBraceToken && ! p .hasPrecedingLineBreak ()
6346
6356
}
6347
6357
6348
6358
func (p * Parser ) nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLineDisallowOf () bool {
6349
- return p .nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine () && p . token != ast . KindOfKeyword
6359
+ return p .nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine ( /*disallowOf*/ true )
6350
6360
}
6351
6361
6352
6362
func (p * Parser ) isAwaitUsingDeclaration () bool {
6353
6363
return p .lookAhead ((* Parser ).nextIsUsingKeywordThenBindingIdentifierOrStartOfObjectDestructuringOnSameLine )
6354
6364
}
6355
6365
6356
6366
func (p * Parser ) nextIsUsingKeywordThenBindingIdentifierOrStartOfObjectDestructuringOnSameLine () bool {
6357
- return p .nextToken () == ast .KindUsingKeyword && p .nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine ()
6367
+ return p .nextToken () == ast .KindUsingKeyword && p .nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine ( /*disallowOf*/ false )
6358
6368
}
6359
6369
6360
6370
func (p * Parser ) nextTokenIsTokenStringLiteral () bool {
0 commit comments