forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewsideeffect.js
More file actions
54 lines (43 loc) · 1.31 KB
/
newsideeffect.js
File metadata and controls
54 lines (43 loc) · 1.31 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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
function echo(m) { this.WScript ? WScript.Echo(m) : console.log(m); }
//
// Win8: 762166
// ES5 11.2.2 "new MemberExpression Arguments", MemberExpression is fully evaluated before Arguments.
// Arguments side effect can't change the constructor used for new operator.
//
(function(){
function x(){ echo("x");}
function y(){ echo("y");}
new x(x = y);
new x();
})();
(function(){
function x(){ echo("x");}
function y(){ echo("y");}
new x(x = y);
new x();
function foo() {
x(); // Reference of "x" and put it in slot
}
})();
(function () {
var o = {
x: function () { echo("x"); }
};
function y() { echo("y"); }
new o.x(o.x = y);
new o.x();
})();
(function () {
var o = {
x: function () { echo("x"); }
};
var y = {
x: function () { echo("y"); }
};
new o.x(o = y);
new o.x();
})();