trap-is-not-callable.js (576B)
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.8 5 description: > 6 Trap is not callable. 7 info: | 8 [[Get]] (P, Receiver) 9 10 6. Let trap be GetMethod(handler, "get"). 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 get: {} 21 }); 22 23 assert.throws(TypeError, function() { 24 p.attr; 25 }); 26 27 assert.throws(TypeError, function() { 28 p["attr"]; 29 }); 30 31 reportCompare(0, 0);