Debian Codegraph @

js/src/tests/test262/language/statements/with/has-binding-idref-with-proxy-env.js

raw
1 // Copyright (C) 2024 André Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-object-environment-records-hasbinding-n
6 description: >
7 Lookups in proxy binding object for identifier reference.
8 info: |
9 9.1.1.2.1 HasBinding ( N )
10
11 1. Let bindingObject be envRec.[[BindingObject]].
12 2. Let foundBinding be ? HasProperty(bindingObject, N).
13 3. If foundBinding is false, return false.
14 ...
15
16 features: [Proxy, Reflect]
17 flags: [noStrict]
18 includes: [compareArray.js, proxyTrapsHelper.js]
19 ---*/
20
21 var log = [];
22
23 // Empty environment.
24 var env = {};
25
26 var proxy = new Proxy(env, allowProxyTraps({
27 has(t, pk) {
28 log.push("has:" + String(pk));
29 return Reflect.has(t, pk);
30 },
31 }));
32
33 with (proxy) {
34 Object;
35 }
36
37 assert.compareArray(log, [
38 // HasBinding, step 2.
39 "has:Object",
40 ]);
41
42 reportCompare(0, 0);