call-with.js (768B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 9.5.7 5 description: > 6 A `with` variable check trigger trap.call(handler, target, P); 7 info: | 8 [[HasProperty]] (P) 9 10 ... 11 9. Let booleanTrapResult be ToBoolean(Call(trap, handler, «target, P»)). 12 ... 13 flags: [noStrict] 14 features: [Proxy] 15 ---*/ 16 17 var _handler, _target, _prop; 18 var target = {}; 19 var handler = { 20 has: function(t, prop) { 21 _handler = this; 22 _target = t; 23 _prop = prop; 24 25 return true; 26 } 27 }; 28 var p = new Proxy(target, handler); 29 30 with(p) { 31 (attr); 32 } 33 34 assert.sameValue(_handler, handler); 35 assert.sameValue(_target, target); 36 assert.sameValue(_prop, "attr"); 37 38 reportCompare(0, 0);