trap-is-not-callable.js (588B)
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.9 5 description: > 6 Trap is not callable. 7 info: | 8 [[Set]] ( P, V, Receiver) 9 10 6. Let trap be GetMethod(handler, "set"). 11 ... 12 13 7.3.9 GetMethod (O, P) 14 15 5. If IsCallable(func) is false, throw a TypeError exception. 16 features: [Proxy] 17 ---*/ 18 19 var p = new Proxy({}, { 20 set: {} 21 }); 22 23 assert.throws(TypeError, function() { 24 p.attr = 1; 25 }); 26 27 assert.throws(TypeError, function() { 28 p["attr"] = 1; 29 }); 30 31 reportCompare(0, 0);