blob: 795e9dc0e83c8746007f5b168236e62611782146 (
plain)
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
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-new-operator-runtime-semantics-evaluation
es6id: 12.3.3.1
description: Value when invoked via NewExpression
info: |
NewExpression:newNewExpression
1. Return ? EvaluateNew(NewExpression, empty).
MemberExpression:newMemberExpressionArguments
2. Return ? EvaluateNew(MemberExpression, Arguments).
12.3.3.1.1 Runtime Semantics: EvaluateNew
[...]
8. Return ? Construct(constructor, argList).
7.3.13 Construct (F [ , argumentsList [ , newTarget ]])
1. If newTarget was not passed, let newTarget be F.
features: [new.target]
---*/
var newTarget = null;
function f() {
newTarget = new.target;
}
new f;
assert.sameValue(newTarget, f, 'Invoked without Arguments');
newTarget = null;
new f();
assert.sameValue(newTarget, f, 'Invoked with Arguments');
reportCompare(0, 0);
|