@poe-platform/safe-js 0.1.143 → 0.1.145

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.
@@ -4619,14 +4619,15 @@ var Parser = class {
4619
4619
  }
4620
4620
  parseObjectProperty() {
4621
4621
  const generatorToken = this.currentToken().type === "punctuator" && this.currentToken().value === "*" ? this.currentToken() : this.currentToken().type === "keyword" && this.currentToken().value === "async" && this.peekToken(1).type === "punctuator" && this.peekToken(1).value === "*" ? this.peekToken(1) : void 0;
4622
- if (generatorToken !== void 0) {
4622
+ if (generatorToken !== void 0 && this.currentToken().value !== "*") {
4623
4623
  throw new Error(
4624
4624
  `Generator shorthand methods are not supported at line ${generatorToken.start.line}, column ${generatorToken.start.column}.`
4625
4625
  );
4626
4626
  }
4627
+ if (generatorToken !== void 0) this.index++;
4627
4628
  let accessor;
4628
4629
  let accessorStart;
4629
- if (this.currentToken().type === "identifier" && (this.currentToken().value === "get" || this.currentToken().value === "set") && this.isObjectMethodStart()) {
4630
+ if (generatorToken === void 0 && this.currentToken().type === "identifier" && (this.currentToken().value === "get" || this.currentToken().value === "set") && this.isObjectMethodStart()) {
4630
4631
  const token2 = this.currentToken();
4631
4632
  if (token2.end.offset - token2.start.offset !== token2.value.length)
4632
4633
  throw unexpectedTokenError(token2);
@@ -4635,7 +4636,7 @@ var Parser = class {
4635
4636
  this.index++;
4636
4637
  }
4637
4638
  const modifierToken = this.currentToken();
4638
- const asyncToken = modifierToken.type === "keyword" && modifierToken.value === "async" && modifierToken.end.offset - modifierToken.start.offset === modifierToken.value.length && this.isObjectMethodStart() && !hasLineBreakBetween(modifierToken, this.peekToken(1)) ? modifierToken : void 0;
4639
+ const asyncToken = generatorToken === void 0 && modifierToken.type === "keyword" && modifierToken.value === "async" && modifierToken.end.offset - modifierToken.start.offset === modifierToken.value.length && this.isObjectMethodStart() && !hasLineBreakBetween(modifierToken, this.peekToken(1)) ? modifierToken : void 0;
4639
4640
  if (asyncToken !== void 0) {
4640
4641
  this.index += 1;
4641
4642
  }
@@ -4644,7 +4645,7 @@ var Parser = class {
4644
4645
  const key = this.parseExpression();
4645
4646
  this.expectPunctuator("]");
4646
4647
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
4647
- const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? propertyStart.start, accessor);
4648
+ const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? propertyStart.start, accessor, generatorToken);
4648
4649
  return {
4649
4650
  type: "Property",
4650
4651
  ...accessor === void 0 ? {} : { kind: accessor },
@@ -4655,6 +4656,7 @@ var Parser = class {
4655
4656
  span: createSpan2(value2.span.start, value2.span.end)
4656
4657
  };
4657
4658
  }
4659
+ if (generatorToken !== void 0) throw unexpectedTokenError(this.currentToken());
4658
4660
  this.expectPunctuator(":");
4659
4661
  const value = this.parseExpression();
4660
4662
  return {
@@ -4671,7 +4673,7 @@ var Parser = class {
4671
4673
  this.index += 1;
4672
4674
  const key = createIdentifierName(token);
4673
4675
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
4674
- const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? key.span.start, accessor);
4676
+ const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? key.span.start, accessor, generatorToken);
4675
4677
  return {
4676
4678
  type: "Property",
4677
4679
  ...accessor === void 0 ? {} : { kind: accessor },
@@ -4682,6 +4684,7 @@ var Parser = class {
4682
4684
  span: createSpan2(value2.span.start, value2.span.end)
4683
4685
  };
4684
4686
  }
4687
+ if (generatorToken !== void 0) throw unexpectedTokenError(this.currentToken());
4685
4688
  if (this.consumePunctuator(":") === void 0) {
4686
4689
  if (!isIdentifierLikeToken(token)) throw unexpectedTokenError(token);
4687
4690
  assertAllowedIdentifierReference(token);
@@ -4708,7 +4711,7 @@ var Parser = class {
4708
4711
  this.index += 1;
4709
4712
  const key = createLiteralFromToken(token);
4710
4713
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
4711
- const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? key.span.start, accessor);
4714
+ const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? key.span.start, accessor, generatorToken);
4712
4715
  return {
4713
4716
  type: "Property",
4714
4717
  ...accessor === void 0 ? {} : { kind: accessor },
@@ -4719,6 +4722,7 @@ var Parser = class {
4719
4722
  span: createSpan2(value2.span.start, value2.span.end)
4720
4723
  };
4721
4724
  }
4725
+ if (generatorToken !== void 0) throw unexpectedTokenError(this.currentToken());
4722
4726
  this.expectPunctuator(":");
4723
4727
  const value = this.parseExpression();
4724
4728
  return {
@@ -4756,8 +4760,8 @@ var Parser = class {
4756
4760
  }
4757
4761
  return (propertyToken.type === "identifier" || propertyToken.type === "keyword" || propertyToken.type === "numeric" || propertyToken.type === "string") && this.peekToken(2).type === "punctuator" && this.peekToken(2).value === "(";
4758
4762
  }
4759
- parseObjectMethod(asyncToken, methodStart, accessor) {
4760
- const { params, body } = this.parseFunctionParts(false, {
4763
+ parseObjectMethod(asyncToken, methodStart, accessor, generatorToken) {
4764
+ const { params, body } = this.parseFunctionParts(generatorToken !== void 0, {
4761
4765
  ...ordinaryFunctionContext,
4762
4766
  superProperty: true,
4763
4767
  ...accessor === void 0 ? {} : { await: false, strictAwait: true }
@@ -4766,11 +4770,11 @@ var Parser = class {
4766
4770
  type: "FunctionExpression",
4767
4771
  async: asyncToken !== void 0,
4768
4772
  body,
4769
- generator: false,
4773
+ generator: generatorToken !== void 0,
4770
4774
  id: void 0,
4771
4775
  method: true,
4772
4776
  params,
4773
- span: createSpan2(asyncToken?.start ?? methodStart, body.span.end)
4777
+ span: createSpan2(asyncToken?.start ?? generatorToken?.start ?? methodStart, body.span.end)
4774
4778
  });
4775
4779
  }
4776
4780
  parseIdentifierName() {
@@ -13491,7 +13495,7 @@ var AS001Scanner = class {
13491
13495
  previousToken = token;
13492
13496
  continue;
13493
13497
  }
13494
- if (token.type === "punctuator" && token.value === "*" && isGeneratorMemberToken(previousToken, previousPreviousToken, braceContextStack)) {
13498
+ if (token.type === "punctuator" && token.value === "*" && previousToken?.value === "async" && isGeneratorMemberToken(previousToken, previousPreviousToken, braceContextStack)) {
13495
13499
  this.report("generator", token.start, token.end);
13496
13500
  }
13497
13501
  lastClosedControlParenthesis = token.type === "punctuator" ? updateGroupingState2(groupingStack, previousToken, token.value) : false;
@@ -28799,7 +28803,7 @@ async function interpret(node, options = {}) {
28799
28803
  }
28800
28804
  async function evaluateNode(node, context) {
28801
28805
  context.assertActive?.();
28802
- if (context.inferredName !== void 0 && node.type !== "ClassExpression") context = { ...context, inferredName: void 0 };
28806
+ if (context.inferredName !== void 0 && node.type !== "ClassExpression" && !(node.type === "FunctionExpression" && node.method === true)) context = { ...context, inferredName: void 0 };
28803
28807
  const replayWait = promiseReplayContext.getStore()?.beforeNode(node.nodeId);
28804
28808
  if (replayWait !== void 0) await suspendJob(replayWait);
28805
28809
  assertPromiseExecutionAllowed();
@@ -31647,7 +31651,7 @@ function createInterpretedClosure(node, context, evaluateNode2, homeObject) {
31647
31651
  sandbox: true,
31648
31652
  length: getFunctionLength(node.params),
31649
31653
  ...node.async ? { async: true } : {},
31650
- ...node.type === "FunctionDeclaration" || node.type === "FunctionExpression" ? node.id === void 0 ? {} : { name: node.id.name } : {},
31654
+ ...node.type === "FunctionDeclaration" || node.type === "FunctionExpression" ? node.id === void 0 ? { name: context.inferredName } : { name: node.id.name } : {},
31651
31655
  ...construct === void 0 ? {} : { construct },
31652
31656
  retainedValues: () => [...context.scope.retainedValues(), context.functionEnvironment?.homeObject, context.functionEnvironment?.newTarget],
31653
31657
  call: (args, callContext) => {
@@ -31710,7 +31714,7 @@ function createGeneratorClosure(node, context, evaluateNode2) {
31710
31714
  generator: true,
31711
31715
  sandbox: true,
31712
31716
  length: getFunctionLength(node.params),
31713
- ...node.id === void 0 ? {} : { name: node.id.name },
31717
+ ...node.id === void 0 ? { name: context.inferredName } : { name: node.id.name },
31714
31718
  retainedValues: () => [...context.scope.retainedValues(), context.functionEnvironment?.homeObject, context.functionEnvironment?.newTarget],
31715
31719
  call: async (args, callContext) => {
31716
31720
  const closureContext = {
@@ -35530,4 +35534,4 @@ export {
35530
35534
  FileSnapshotBackend,
35531
35535
  run
35532
35536
  };
35533
- //# sourceMappingURL=chunk-2DVGJCK5.js.map
35537
+ //# sourceMappingURL=chunk-OVRBSGVT.js.map