@enclave-vm/core 2.15.0 → 2.15.2

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/esm/worker.mjs CHANGED
@@ -526,7 +526,11 @@ var Interpreter = class {
526
526
  const obj = value ?? {};
527
527
  for (const prop of pattern.properties) {
528
528
  if (prop.type === "RestElement") continue;
529
- const key = prop.key.name;
529
+ if (prop.computed) throw new InterpreterError("Computed destructuring keys are not allowed");
530
+ let key;
531
+ if (prop.key.type === "Identifier") key = prop.key.name;
532
+ else if (prop.key.type === "Literal") key = String(prop.key.value);
533
+ else throw new InterpreterError("Unsupported destructuring key");
530
534
  if (BLOCKED_KEYS.has(key)) throw new InterpreterError(`Forbidden destructured key: ${key}`);
531
535
  this.bindPattern(prop.value, obj[key], scope, mutable);
532
536
  }