Avoid using destructuring in tco-fn-realm.js

This commit is contained in:
tannal 2024-10-09 10:08:04 +08:00 committed by Philip Chimento
parent ab809f8f0c
commit 954d6370f9
2 changed files with 6 additions and 2 deletions

View File

@ -27,13 +27,15 @@ assert.sameValue(Array.prototype.toString.call({ join: {} }), "[object Object]")
let revokeOnGet = false;
const proxyTarget = [];
const { proxy, revoke } = Proxy.revocable(proxyTarget, {
var proxyObj = Proxy.revocable(proxyTarget, {
get: (target, key, receiver) => {
if (revokeOnGet)
revoke();
return Reflect.get(target, key, receiver);
},
});
var proxy = proxyObj.proxy;
var revoke = proxyObj.revoke;
proxyTarget.join = undefined;
assert.sameValue(Array.prototype.toString.call(proxy), "[object Array]");

View File

@ -12,7 +12,9 @@ features: [Proxy, tail-call-optimization]
var other = $262.createRealm();
var F = other.evalScript(`
(function() {
var { proxy, revoke } = Proxy.revocable(function() {}, {});
var proxyObj = Proxy.revocable(function() {}, {});
var proxy = proxyObj.proxy;
var revoke = proxyObj.revoke;
revoke();
return proxy();
})