mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-04 05:33:50 +01:00 
			
		
		
		
	* Add missing test for early error * Add missing test for WithBaseObject * Improve coverage for `new.target` * Add test for deletion of SuperReference * Add tests for `in` keyword restrictions * fixup! Improve coverage for `new.target`
		
			
				
	
	
		
			29 lines
		
	
	
		
			713 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			713 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// 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).
 | 
						|
features: [Reflect]
 | 
						|
---*/
 | 
						|
 | 
						|
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');
 |