Debian Codegraph @

rhino/testsrc/tests/js1_5/Function/15.3.4.4.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = '15.3.4.4.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 290488;
9 var summary = '15.3.4.4 - Function.prototype.call() Scope';
10 var actual = '';
11 var expect = '';
12 var description = '';
13 var GLOBAL = this;
14
15 printBugNumber(BUGNUMBER);
16 printStatus (summary);
17
18 printStatus(inSection(1));
19
20 function func() { return this; }
21
22 description = 'top-level function: this == GLOBAL';
23 expect = GLOBAL;
24 actual = func.call();
25 reportCompare(expect, actual, description);
26
27 printStatus(inSection(2));
28
29 function getBoundMethod()
30 {
31 return it.bindMethod("boundMethod", function () { return this; });
32 }
33
34 // it is a js shell only construction
35 if (typeof it != 'undefined')
36 {
37 description = 'bound method: this == GLOBAL';
38 var func = getBoundMethod();
39 expect = GLOBAL;
40 actual = func.call();
41 reportCompare(expect, actual, description);
42 }