-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathDirectCall.js
28 lines (21 loc) · 1.04 KB
/
DirectCall.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var PI = Math.PI;
var c = Math.ceil(PI);
var f = Math.floor(PI);
WScript.Echo(c, f);
(function f()
{
// Test calls that modify the call target operands when the args are evaluated.
// Do this locally, as that's the case that we're most likely to get wrong.
var save;
var O = { foo : function() { return "O.foo"; }, bar : function() { return "O.bar"; } };
O.o = { foo : function() { return "O.o.foo"; }, bar : function() { return "O.o.bar"; } };
WScript.Echo(O.foo(save = O, O = O.o));
WScript.Echo(O.foo(O = save));
var str = 'foo';
WScript.Echo(O[str](O = O.o, str = 'bar'));
WScript.Echo(O[str](O = save, str = 'foo'));
})();