@ibyar/expressions 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/v8/inline.js CHANGED
@@ -461,7 +461,13 @@ export class JavaScriptInlineParser extends AbstractParser {
461
461
  return this.parseClassDeclaration(undefined, false, classToken);
462
462
  case Token.VAR:
463
463
  case Token.CONST:
464
+ case Token.USING:
464
465
  return this.parseVariableDeclarations(VariableDeclarationContext.StatementListItem);
466
+ case Token.AWAIT:
467
+ if (this.isAwaitAllowed()) {
468
+ return this.parseVariableDeclarations(VariableDeclarationContext.StatementListItem);
469
+ }
470
+ break;
465
471
  case Token.LET:
466
472
  if (this.isNextLetKeyword()) {
467
473
  return this.parseVariableDeclarations(VariableDeclarationContext.StatementListItem);
@@ -620,7 +626,7 @@ export class JavaScriptInlineParser extends AbstractParser {
620
626
  this.expect(Token.LPAREN);
621
627
  const peek = this.peek();
622
628
  const starts_with_let = peek.isType(Token.LET);
623
- if (peek.isType(Token.CONST) || (starts_with_let && this.isNextLetKeyword())) {
629
+ if (peek.isType(Token.CONST) || peek.isType(Token.USING) || (starts_with_let && this.isNextLetKeyword())) {
624
630
  // The initializer contains lexical declarations,
625
631
  // so create an in-between scope.
626
632
  // Also record whether inner functions or evals are found inside
@@ -786,10 +792,23 @@ export class JavaScriptInlineParser extends AbstractParser {
786
792
  mode = 'var';
787
793
  break;
788
794
  case Token.LET:
789
- default:
790
795
  this.consume(token);
791
796
  mode = 'let';
792
797
  break;
798
+ case Token.USING:
799
+ this.consume(token);
800
+ mode = 'using';
801
+ break;
802
+ case Token.AWAIT:
803
+ const next = this.peekAhead();
804
+ if (next.token === Token.USING) {
805
+ this.consume(token);
806
+ this.consume(next.token);
807
+ mode = 'await using';
808
+ break;
809
+ }
810
+ default:
811
+ throw new Error(this.errorMessage(`Declaration Missing Initializer`));
793
812
  }
794
813
  const variables = [];
795
814
  do {
@@ -1310,6 +1329,7 @@ export class JavaScriptInlineParser extends AbstractParser {
1310
1329
  // ObjectLiteral
1311
1330
  // RegExpLiteral
1312
1331
  // '(' Expression ')'
1332
+ // TemplateLiteral
1313
1333
  // do Block
1314
1334
  // AsyncFunctionLiteral
1315
1335
  let token = this.peek();
@@ -1680,7 +1700,7 @@ export class JavaScriptInlineParser extends AbstractParser {
1680
1700
  if (this.factory.isAssignmentExpression(argument) && isPattern) {
1681
1701
  throw new SyntaxError(this.errorMessage('Invalid Destructuring Target'));
1682
1702
  }
1683
- if (this.peek().isType(Token.COMMA)) {
1703
+ if (this.peek().isType(Token.COMMA) && isPattern) {
1684
1704
  throw new SyntaxError(this.errorMessage('Element After Rest'));
1685
1705
  }
1686
1706
  }