Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/instanceof/S15.3.5.3_A3_T2.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken:
7 i) Call the [[Get]] method of F with property name "prototype".
8 ii) Let O be Result(i) and O is an object.
9 iii) Let V be the value of the [[Prototype]] property of V.
10 iv) If V is null, return false.
11 v) If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true.
12 vi) Go to step iii)
13 es5id: 15.3.5.3_A3_T2
14 description: F.prototype is Object.prototype, and V is empty object
15 ---*/
16
17 var FAKEFACTORY;
18 FAKEFACTORY = Function();
19
20 var fakeinstance;
21 fakeinstance = {};
22
23 //CHECK#1
24 if (fakeinstance instanceof FAKEFACTORY) {
25 $ERROR('#1: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true');
26 }
27
28 FAKEFACTORY.prototype=Object.prototype;
29
30 //CHECK#2
31 if (!(fakeinstance instanceof FAKEFACTORY)) {
32 $ERROR('#2: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true');
33 }