forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParameterOrder.js
More file actions
65 lines (49 loc) · 1.4 KB
/
ParameterOrder.js
File metadata and controls
65 lines (49 loc) · 1.4 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
//
// Test calling order of parameters:
// 1. Ensure arguments get evaluated in the correct order
// 2. Ensure arguments are passed in the correct order
//
function a()
{
//
// By displaying the function, we'll validate the correct evaluation order.
//
WScript.Echo("a()");
return 1;
}
function b()
{
WScript.Echo("b()");
return 2;
}
function c(p1, p2)
{
//
// By performing a subtract, we'll validate that p1 and p2 are not mixed.
//
WScript.Echo("c(p1, p2)");
return p1 - p2;
}
function MyClass(p1, p2) {
//
// By performing a subtract, we'll validate that p1 and p2 are not mixed.
//
WScript.Echo("MyClass(p1, p2)");
this.value = p1 - p2;
}
//
// Test a regular function call.
//
WScript.Echo("Regular function call");
var result = c(a(), b());
WScript.Echo(result);
//
// Test a constructor function call.
//
WScript.Echo("Constructor function call");
var result = new MyClass(a(), b());
WScript.Echo(result.value);