2016-07-01 20:23:43 +02:00
|
|
|
// 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-reflect.construct
|
|
|
|
es6id: 26.1.2
|
|
|
|
description: Value when invoked via `Reflect.construct`
|
|
|
|
info: |
|
|
|
|
[...]
|
|
|
|
2. If newTarget is not present, let newTarget be target.
|
|
|
|
[...]
|
|
|
|
5. Return ? Construct(target, args, newTarget).
|
2018-07-25 18:16:49 +02:00
|
|
|
features: [new.target, Reflect, Reflect.construct]
|
2016-07-01 20:23:43 +02:00
|
|
|
---*/
|
|
|
|
|
|
|
|
var customNewTarget = function() {};
|
|
|
|
var newTarget = null;
|
|
|
|
|
|
|
|
function f() {
|
|
|
|
newTarget = new.target;
|
|
|
|
}
|
|
|
|
|
|
|
|
Reflect.construct(f, []);
|
|
|
|
|
|
|
|
assert.sameValue(newTarget, f, 'NewTarget unspecified');
|
|
|
|
|
|
|
|
Reflect.construct(f, [], customNewTarget);
|
|
|
|
|
|
|
|
assert.sameValue(newTarget, customNewTarget, 'NewTarget explicitly defined');
|