@poe-platform/safe-js 0.1.225 → 0.1.226

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.
@@ -8581,7 +8581,7 @@ function captureGuestHeapNode(value, encode) {
8581
8581
  ...value.state !== "suspended" || origin2.expressionStates === void 0 ? {} : {
8582
8582
  expressionStates: Object.fromEntries([...origin2.expressionStates].map(([id, expression]) => [
8583
8583
  String(id),
8584
- expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "member-assignment" ? {
8584
+ expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "identifier-assignment" ? { kind: "identifier-assignment", current: encode(expression.current) } : expression.kind === "member-assignment" ? {
8585
8585
  kind: "member-assignment",
8586
8586
  object: encode(expression.object),
8587
8587
  property: encode(expression.property),
@@ -16812,18 +16812,18 @@ async function evaluateBinaryExpression(node, context) {
16812
16812
  }
16813
16813
  async function evaluateAssignmentExpression(node, context) {
16814
16814
  if (node.left.type === "ArrayPattern" || node.left.type === "ObjectPattern") {
16815
- const right2 = await evaluateNode(node.right, context);
16816
- if (right2.kind !== "normal") {
16817
- return right2;
16815
+ const right = await evaluateNode(node.right, context);
16816
+ if (right.kind !== "normal") {
16817
+ return right;
16818
16818
  }
16819
- const binding2 = await bindPattern2(node.left, right2.value, { assign: true }, context.scope, createPatternContext(context));
16819
+ const binding2 = await bindPattern2(node.left, right.value, { assign: true }, context.scope, createPatternContext(context));
16820
16820
  if (!binding2.ok) {
16821
16821
  return binding2.result;
16822
16822
  }
16823
16823
  return {
16824
16824
  kind: "normal",
16825
16825
  hasValue: true,
16826
- value: right2.value
16826
+ value: right.value
16827
16827
  };
16828
16828
  }
16829
16829
  if (node.left.type === "MemberExpression") {
@@ -16839,11 +16839,13 @@ async function evaluateAssignmentExpression(node, context) {
16839
16839
  )
16840
16840
  };
16841
16841
  }
16842
- const binding = node.operator === "=" ? void 0 : context.scope.lookup(node.left.name);
16842
+ const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
16843
+ if (restored !== void 0 && restored.kind !== "identifier-assignment") throw new TypeError("Invalid identifier assignment continuation.");
16844
+ const binding = node.operator === "=" || restored !== void 0 ? void 0 : context.scope.lookup(node.left.name);
16843
16845
  if (binding?.found === false) {
16844
16846
  throw new ReferenceError(`Cannot assign to undeclared binding '${node.left.name}'.`);
16845
16847
  }
16846
- const current = binding?.value;
16848
+ const current = restored === void 0 ? binding?.value : restored.current;
16847
16849
  if (node.operator === "&&=" && !isTruthy(current)) {
16848
16850
  return {
16849
16851
  kind: "normal",
@@ -16865,17 +16867,28 @@ async function evaluateAssignmentExpression(node, context) {
16865
16867
  value: current
16866
16868
  };
16867
16869
  }
16868
- const right = await evaluateNode(node.right, { ...context, inferredName: node.left.type === "Identifier" ? node.left.name : void 0 });
16869
- if (right.kind !== "normal") {
16870
- return right;
16870
+ if (context.generatorYield !== void 0 && node.nodeId !== void 0) {
16871
+ context = { ...context, generatorExpressionStates: new Map([
16872
+ ...context.generatorExpressionStates ?? [],
16873
+ [node.nodeId, { kind: "identifier-assignment", current }]
16874
+ ]) };
16875
+ }
16876
+ const release = retainValues(context.budget, () => [current]);
16877
+ try {
16878
+ const right = await evaluateNode(node.right, { ...context, inferredName: node.left.name });
16879
+ if (right.kind !== "normal") {
16880
+ return right;
16881
+ }
16882
+ const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : await applyCompoundAssignmentOperator(node.operator, current, right.value, context);
16883
+ context.scope.assign(node.left.name, value);
16884
+ return {
16885
+ kind: "normal",
16886
+ hasValue: true,
16887
+ value
16888
+ };
16889
+ } finally {
16890
+ release();
16871
16891
  }
16872
- const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : await applyCompoundAssignmentOperator(node.operator, current, right.value, context);
16873
- context.scope.assign(node.left.name, value);
16874
- return {
16875
- kind: "normal",
16876
- hasValue: true,
16877
- value
16878
- };
16879
16892
  }
16880
16893
  async function evaluateMemberAssignmentExpression(node, context) {
16881
16894
  if (node.left.type !== "MemberExpression") {
@@ -22472,6 +22485,8 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
22472
22485
  const expression = record2(raw2);
22473
22486
  if (expression.kind === "binary") {
22474
22487
  fields(expression, ["kind", "left"]);
22488
+ } else if (expression.kind === "identifier-assignment") {
22489
+ fields(expression, ["kind", "current"]);
22475
22490
  } else if (expression.kind === "member-assignment") {
22476
22491
  fields(expression, ["kind", "object", "property", "current"], ["key", "superReceiver"]);
22477
22492
  if (Object.hasOwn(expression, "key") && typeof expression.key !== "string") reference(expression.key, ["symbol"]);
@@ -22652,7 +22667,7 @@ function validateGuestFunctionAst(record3, origin) {
22652
22667
  pending.push({
22653
22668
  value,
22654
22669
  blocks,
22655
- expressions: node.type === "BinaryExpression" && key === "right" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "binary" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "MemberExpression" ? new Map([...frame.expressions, [node.nodeId, {
22670
+ expressions: node.type === "BinaryExpression" && key === "right" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "binary" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "Identifier" ? new Map([...frame.expressions, [node.nodeId, { kind: "identifier-assignment" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "MemberExpression" ? new Map([...frame.expressions, [node.nodeId, {
22656
22671
  kind: "member-assignment",
22657
22672
  key: node.operator !== "=",
22658
22673
  superReceiver: node.left.object.type === "Super"
@@ -22682,7 +22697,7 @@ function validateGuestFunctionAst(record3, origin) {
22682
22697
  for (const [id, expression] of expressions) {
22683
22698
  const expected = yieldExpressions?.get(Number(id));
22684
22699
  const compatibleKind = expected?.kind === expression.kind || expected?.kind === "call" && expected.member === true && expression.kind === "array-call";
22685
- if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.index !== expression.index || expected.kind === "member-assignment" && (expected.key !== Object.hasOwn(expression, "key") || expected.superReceiver !== Object.hasOwn(expression, "superReceiver")) || expected.kind === "member" && expected.superReceiver !== Object.hasOwn(expression, "superReceiver") || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
22700
+ if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.index !== expression.index || expected.kind === "member-assignment" && (expected.key !== Object.hasOwn(expression, "key") || expected.superReceiver !== Object.hasOwn(expression, "superReceiver")) || expected.kind === "member" && expected.superReceiver !== Object.hasOwn(expression, "superReceiver") || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
22686
22701
  throw new TypeError("Invalid generator AST identity: unrelated expression continuation");
22687
22702
  }
22688
22703
  }
@@ -38928,4 +38943,4 @@ export {
38928
38943
  FileSnapshotBackend,
38929
38944
  run
38930
38945
  };
38931
- //# sourceMappingURL=chunk-P2JEDD2J.js.map
38946
+ //# sourceMappingURL=chunk-EY6YV2R2.js.map