michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Only Function objects implement [[HasInstance]] and can be proper ShiftExpression for the "instanceof" operator consequently michael@0: * michael@0: * @path ch11/11.8/11.8.6/S11.8.6_A6_T4.js michael@0: * @description Checking if RelationalExpression is object michael@0: */ michael@0: michael@0: MyFunct = function(){}; michael@0: __my__funct = new MyFunct; michael@0: michael@0: michael@0: //CHECK#1 michael@0: if (!(__my__funct instanceof MyFunct)){ michael@0: $ERROR('#1 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); michael@0: } michael@0: michael@0: //CHECK#2 michael@0: if (__my__funct instanceof Function){ michael@0: $ERROR('#2 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); michael@0: } michael@0: michael@0: //CHECK#3 michael@0: if (!(__my__funct instanceof Object)){ michael@0: $ERROR('#3 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); michael@0: } michael@0: michael@0: //CHECK#4 michael@0: try{ michael@0: __my__funct instanceof __my__funct; michael@0: $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); michael@0: } michael@0: catch(e){ michael@0: if (e instanceof TypeError !== true) { michael@0: $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); michael@0: } michael@0: } michael@0: