  1520→ *
  1521→ * @param parser  Parser object
  1522→ * @param context Context masks
  1523→ * @param scope Scope object
  1524→ * @param origin Binding origin
  1525→ */
  1526→function parseLetIdentOrVarDeclarationStatement(
  1527→  parser: Parser,
  1528→  context: Context,
  1529→  scope: Scope | undefined,
  1530→  privateScope: PrivateScope | undefined,
  1531→  origin: Origin,
  1532→): ESTree.VariableDeclaration | ESTree.LabeledStatement | ESTree.ExpressionStatement {
  1533→  const { tokenValue, tokenStart } = parser;
  1534→  const token = parser.getToken();
  1535→  let expr: ESTree.Identifier | ESTree.Expression = parseIdentifier(parser, context);
  1536→
  1537→  if (parser.getToken() & (Token.IsIdentifier | Token.IsPatternStart)) {
  1538→    /* VariableDeclarations ::
  1539→     *  ('let') (Identifier ('=' AssignmentExpression)?)+[',']
  1540→     */
  1541→
  1542→    const declarations = parseVariableDeclarationList(
  1543→      parser,
  1544→      context,
  1545→      scope,
  1546→      privateScope,
  1547→      BindingKind.Let,
  1548→      Origin.None,
  1549→    );
  1550→
  1551→    matchOrInsertSemicolon(parser, context | Context.AllowRegExp);
  1552→
  1553→    return parser.finishNode<ESTree.VariableDeclaration>(
  1554→      {
  1555→        type: 'VariableDeclaration',
  1556→        kind: 'let',
  1557→        declarations,
  1558→      },
  1559→      tokenStart,
  1560→    );
  1561→  }
  1562→  // 'Let' as identifier
  1563→  parser.assignable = AssignmentKind.Assignable;
  1564→
  1565→  if (context & Context.Strict) parser.report(Errors.UnexpectedLetStrictReserved);
  1566→
  1567→  /** LabelledStatement[Yield, Await, Return]:
  1568→   *
  1569→   * ExpressionStatement | LabelledStatement ::
  1570→   * Expression ';'
  1571→   *   Identifier ':' Statement
  1572→   *
  1573→   * ExpressionStatement[Yield] :
  1574→   *   [lookahead not in {{, function, class, let [}] Expression[In, ?Yield] ;
  1575→   */
  1576→
  1577→  if (parser.getToken() === Token.Colon) {
  1578→    return parseLabelledStatement(
  1579→      parser,
  1580→      context,
  1581→      scope,
  1582→      privateScope,
  1583→      origin,
  1584→      {},
  1585→      tokenValue,
  1586→      expr,
  1587→      token,
  1588→      0,
  1589→      tokenStart,
  1590→    );
  1591→  }
  1592→
  1593→  /**
  1594→   * ArrowFunction :
  1595→   *   ArrowParameters => ConciseBody
  1596→   *
  1597→   * ConciseBody :
  1598→   *   [lookahead not {] AssignmentExpression
  1599→   *   { FunctionBody }
  1600→   *
  1601→   */
  1602→  if (parser.getToken() === Token.Arrow) {
  1603→    let scope: Scope | undefined = void 0;
  1604→
  1605→    if (parser.options.lexical) scope = createArrowHeadParsingScope(parser, context, tokenValue);
  1606→
  1607→    parser.flags = (parser.flags | Flags.NonSimpleParameterList) ^ Flags.NonSimpleParameterList;
  1608→
  1609→    expr = parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], /* isAsync */ 0, tokenStart);
  1610→  } else {
  1611→    /**
  1612→     * UpdateExpression ::
  1613→     *   ('++' | '--')? LeftHandSideExpression
  1614→     *
  1615→     * MemberExpression ::
  1616→     *   (PrimaryExpression | FunctionLiteral | ClassLiteral)
  1617→     *     ('[' Expression ']' | '.' Identifier | Arguments | TemplateLiteral)*
  1618→     *
  1619→     * CallExpression ::
  1620→     *   (SuperCall | ImportCall)
  1621→     *     ('[' Expression ']' | '.' Identifier | Arguments | TemplateLiteral)*
  1622→     *
  1623→     * LeftHandSideExpression ::
  1624→     *   (NewExpression | MemberExpression) ...
  1625→     */
  1626→
  1627→    expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
  1628→
  1629→    /**
  1630→     * AssignmentExpression :
  1631→     *   1. ConditionalExpression
  1632→     *   2. LeftHandSideExpression = AssignmentExpression
  1633→     *
  1634→     */
  1635→    expr = parseAssignmentExpression(
  1636→      parser,
  1637→      context,
  1638→      privateScope,
  1639→      0,
  1640→      0,
  1641→      tokenStart,
  1642→      expr as ESTree.ArgumentExpression,
  1643→    );
  1644→  }
  1645→
  1646→  /** Sequence expression
  1647→   */
  1648→  if (parser.getToken() === Token.Comma) {
  1649→    expr = parseSequenceExpression(parser, context, privateScope, 0, tokenStart, expr);
  1650→  }
  1651→
  1652→  /**
  1653→   * ExpressionStatement[Yield, Await]:
  1654→   *  [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]Expression[+In, ?Yield, ?Await]
  1655→   */
  1656→  return parseExpressionStatement(parser, context, expr, tokenStart);
  1657→}
  1658→
  1659→/**
  1660→ * Parses a `const` or `let` lexical declaration statement
  1661→ *
  1662→ * @param parser  Parser object
  1663→ * @param context Context masks
  1664→ * @param type Binding kind
  1665→ * @param origin Binding origin
  1666→ * @param type Binding kind
  1667→ */
  1668→function parseLexicalDeclaration(
  1669→  parser: Parser,
  1670→  context: Context,
  1671→  scope: Scope | undefined,
  1672→  privateScope: PrivateScope | undefined,
  1673→  kind: BindingKind,
  1674→  origin: Origin,
  1675→): ESTree.VariableDeclaration {
  1676→  // BindingList ::
  1677→  //  LexicalBinding
  1678→  //    BindingIdentifier
  1679→  //    BindingPattern
  1680→
  1681→  const start = parser.tokenStart;
  1682→
  1683→  nextToken(parser, context);
  1684→
  1685→  const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin);
  1686→
  1687→  matchOrInsertSemicolon(parser, context | Context.AllowRegExp);
  1688→
  1689→  return parser.finishNode<ESTree.VariableDeclaration>(
  1690→    {
  1691→      type: 'VariableDeclaration',
  1692→      kind: kind & BindingKind.Let ? 'let' : 'const',
  1693→      declarations,
  1694→    },
  1695→    start,
  1696→  );
  1697→}
  1698→
  1699→/**
  1700→ * Parses a variable declaration statement
  1701→ *
  1702→ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
  1703→ *
  1704→ * @param parser  Parser object
  1705→ * @param context Context masks
  1706→ * @param scope Scope object
  1707→ * @param origin Binding origin
  1708→ */
  1709→function parseVariableStatement(
  1710→  parser: Parser,
  1711→  context: Context,
  1712→  scope: Scope | undefined,
  1713→  privateScope: PrivateScope | undefined,
  1714→  origin: Origin,
  1715→): ESTree.VariableDeclaration {
  1716→  // VariableDeclarations ::
  1717→  //  ('var') (Identifier ('=' AssignmentExpression)?)+[',']
  1718→  //
  1719→
  1720→  const start = parser.tokenStart;
  1721→
  1722→  nextToken(parser, context);
  1723→  const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, BindingKind.Variable, origin);
  1724→
  1725→  matchOrInsertSemicolon(parser, context | Context.AllowRegExp);
  1726→  return parser.finishNode<ESTree.VariableDeclaration>(
  1727→    {
  1728→      type: 'VariableDeclaration',
  1729→      kind: 'var',
  1730→      declarations,
  1731→    },
  1732→    start,
  1733→  );
  1734→}
  1735→
  1736→/**
  1737→ * Parses variable declaration list
  1738→ *
  1739→ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
  1740→ *
  1741→ * @param parser  Parser object
  1742→ * @param context Context masks
  1743→ * @param type Binding kind
  1744→ * @param origin Binding origin
  1745→ */
  1746→function parseVariableDeclarationList(
  1747→  parser: Parser,
  1748→  context: Context,
  1749→  scope: Scope | undefined,
  1750→  privateScope: PrivateScope | undefined,
  1751→  kind: BindingKind,
  1752→  origin: Origin,
  1753→): ESTree.VariableDeclarator[] {
  1754→  let bindingCount = 1;
  1755→  const list: ESTree.VariableDeclarator[] = [
  1756→    parseVariableDeclaration(parser, context, scope, privateScope, kind, origin),
  1757→  ];
  1758→  while (consumeOpt(parser, context, Token.Comma)) {
  1759→    bindingCount++;
  1760→    list.push(parseVariableDeclaration(parser, context, scope, privateScope, kind, origin));
  1761→  }
  1762→
  1763→  if (bindingCount > 1 && origin & Origin.ForStatement && parser.getToken() & Token.IsInOrOf) {
  1764→    parser.report(Errors.ForInOfLoopMultiBindings, KeywordDescTable[parser.getToken() & Token.Type]);
  1765→  }
  1766→  return list;
  1767→}
  1768→
  1769→/**
  1770→ * Parses variable declaration
  1771→ *
  1772→ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclaration)
  1773→ *
  1774→ * @param parser  Parser object
  1775→ * @param context Context masks
  1776→ */
  1777→function parseVariableDeclaration(
  1778→  parser: Parser,
  1779→  context: Context,
  1780→  scope: Scope | undefined,
  1781→  privateScope: PrivateScope | undefined,
  1782→  kind: BindingKind,
  1783→  origin: Origin,
  1784→): ESTree.VariableDeclarator {
  1785→  // VariableDeclaration :
  1786→  //   BindingIdentifier Initializer opt
  1787→  //   BindingPattern Initializer
  1788→  //
  1789→  // VariableDeclarationNoIn :
  1790→  //   BindingIdentifier InitializerNoIn opt
  1791→  //   BindingPattern InitializerNoIn
  1792→
  1793→  const { tokenStart } = parser;
  1794→  const token = parser.getToken();
  1795→
  1796→  let init: ESTree.Expression | ESTree.BindingPattern | ESTree.Identifier | null = null;
  1797→
  1798→  const id = parseBindingPattern(parser, context, scope, privateScope, kind, origin);
  1799→
  1800→  if (parser.getToken() === Token.Assign) {
  1801→    nextToken(parser, context | Context.AllowRegExp);
  1802→    init = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart);
  1803→    if (origin & Origin.ForStatement || (token & Token.IsPatternStart) === 0) {
  1804→      // Lexical declarations in for-in / for-of loops can't be initialized
  1805→
  1806→      if (
  1807→        parser.getToken() === Token.OfKeyword ||
  1808→        (parser.getToken() === Token.InKeyword &&
  1809→          (token & Token.IsPatternStart || (kind & BindingKind.Variable) === 0 || context & Context.Strict))
  1810→      ) {
  1811→        throw new ParseError(
  1812→          tokenStart,
  1813→          parser.currentLocation,
  1814→          Errors.ForInOfLoopInitializer,
  1815→          parser.getToken() === Token.OfKeyword ? 'of' : 'in',
  1816→        );
  1817→      }
  1818→    }
  1819→    // Normal const declarations, and const declarations in for(;;) heads, must be initialized.
  1820→  } else if (
  1821→    (kind & BindingKind.Const || (token & Token.IsPatternStart) > 0) &&
  1822→    (parser.getToken() & Token.IsInOrOf) !== Token.IsInOrOf
  1823→  ) {
  1824→    parser.report(Errors.DeclarationMissingInitializer, kind & BindingKind.Const ? 'const' : 'destructuring');
  1825→  }
  1826→
  1827→  return parser.finishNode<ESTree.VariableDeclarator>(
  1828→    {
  1829→      type: 'VariableDeclarator',
  1830→      id,
  1831→      init,
  1832→    },
  1833→    tokenStart,
  1834→  );
  1835→}
  1836→
  1837→/**
  1838→ * Parses either For, ForIn or ForOf statement
  1839→ *
  1840→ * @see [Link](https://tc39.github.io/ecma262/#sec-for-statement)
  1841→ * @see [Link](https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements)
  1842→ *
  1843→ * @param parser Parser object
  1844→ * @param context Context masks
  1845→
  1846→ */
  1847→function parseForStatement(
  1848→  parser: Parser,
  1849→  context: Context,

[7064 more lines in file. Use offset=1850 to continue.]