aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/proxy-get-property.tq
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/builtins/proxy-get-property.tq')
-rw-r--r--deps/v8/src/builtins/proxy-get-property.tq32
1 files changed, 17 insertions, 15 deletions
diff --git a/deps/v8/src/builtins/proxy-get-property.tq b/deps/v8/src/builtins/proxy-get-property.tq
index 0915a66d5f..bac07f550c 100644
--- a/deps/v8/src/builtins/proxy-get-property.tq
+++ b/deps/v8/src/builtins/proxy-get-property.tq
@@ -6,9 +6,8 @@
namespace proxy {
- extern transitioning runtime
- GetPropertyWithReceiver(implicit context: Context)(Object, Name, Object, Smi):
- Object;
+ extern transitioning builtin GetPropertyWithReceiver(
+ implicit context: Context)(Object, Name, Object, Smi): Object;
// ES #sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver
@@ -16,36 +15,38 @@ namespace proxy {
ProxyGetProperty(implicit context: Context)(
proxy: JSProxy, name: Name, receiverValue: Object,
onNonExistent: Smi): Object {
+ PerformStackCheck();
// 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name));
assert(IsName(name));
assert(!IsPrivateSymbol(name));
// 2. Let handler be O.[[ProxyHandler]].
- const handler: Object = proxy.handler;
-
// 3. If handler is null, throw a TypeError exception.
- if (handler == Null) {
- ThrowTypeError(kProxyRevoked, 'get');
- }
-
// 4. Assert: Type(handler) is Object.
- const handlerJSReceiver = UnsafeCast<JSReceiver>(handler);
+ let handler: JSReceiver;
+ typeswitch (proxy.handler) {
+ case (Null): {
+ ThrowTypeError(kProxyRevoked, 'get');
+ }
+ case (h: JSReceiver): {
+ handler = h;
+ }
+ }
// 5. Let target be O.[[ProxyTarget]].
- const target = proxy.target;
+ const target = Cast<JSReceiver>(proxy.target) otherwise unreachable;
// 6. Let trap be ? GetMethod(handler, "get").
// 7. If trap is undefined, then (see 7.a below).
// 7.a. Return ? target.[[Get]](P, Receiver).
- // TODO(mslekova): Introduce GetPropertyWithReceiver stub
- const trap: Callable = GetMethod(handlerJSReceiver, 'get')
+ const trap: Callable = GetMethod(handler, 'get')
otherwise return GetPropertyWithReceiver(
target, name, receiverValue, onNonExistent);
// 8. Let trapResult be ? Call(trap, handler, « target, P, Receiver »).
const trapResult =
- Call(context, trap, handlerJSReceiver, target, name, receiverValue);
+ Call(context, trap, handler, target, name, receiverValue);
// 9. Let targetDesc be ? target.[[GetOwnProperty]](P).
// 10. If targetDesc is not undefined and targetDesc.[[Configurable]] is
@@ -58,6 +59,7 @@ namespace proxy {
// is undefined, then
// i. If trapResult is not undefined, throw a TypeError exception.
// 11. Return trapResult.
- return CheckGetSetTrapResult(target, proxy, name, trapResult, kProxyGet);
+ CheckGetSetTrapResult(target, proxy, name, trapResult, kProxyGet);
+ return trapResult;
}
}