symbol-hasinstance-not-callable.js (758B)
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 /*--- 5 es6id: 12.9.4 6 description: > 7 Error thrown when constructor's @@hasInstance property is defined but not callable 8 info: | 9 1. If Type(C) is not Object, throw a TypeError exception. 10 2. Let instOfHandler be GetMethod(C,@@hasInstance). 11 3. ReturnIfAbrupt(instOfHandler). 12 4. If instOfHandler is not undefined, then 13 a. Return ToBoolean(Call(instOfHandler, C, «O»)). 14 5. If IsCallable(C) is false, throw a TypeError exception. 15 features: [Symbol.hasInstance] 16 ---*/ 17 18 var F = {}; 19 20 F[Symbol.hasInstance] = null; 21 22 assert.throws(TypeError, function() { 23 0 instanceof F; 24 }); 25 26 reportCompare(0, 0);