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`
		
			
				
	
	
		
			36 lines
		
	
	
		
			941 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			941 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-delete-operator-runtime-semantics-evaluation
 | 
						|
es6id: 12.5.4.2
 | 
						|
description: SuperReferences may not be deleted
 | 
						|
info: |
 | 
						|
  [...]
 | 
						|
  5.If IsPropertyReference(ref) is true, then
 | 
						|
    a. If IsSuperReference(ref) is true, throw a ReferenceError exception.
 | 
						|
features: [class]
 | 
						|
---*/
 | 
						|
 | 
						|
var caught;
 | 
						|
 | 
						|
class C extends Object {
 | 
						|
  constructor() {
 | 
						|
    try {
 | 
						|
      delete super.x;
 | 
						|
    } catch (err) {
 | 
						|
      caught = err;
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
// When the "construct" invocation completes and the "this" value is
 | 
						|
// uninitialized, the specification dictates that a ReferenceError must be
 | 
						|
// thrown. That behavior is tested elsewhere, so the error is ignored (if it is
 | 
						|
// produced at all).
 | 
						|
try {
 | 
						|
  new C();
 | 
						|
} catch (_) {}
 | 
						|
 | 
						|
assert.sameValue(typeof caught, 'object');
 | 
						|
assert.sameValue(caught.constructor, ReferenceError);
 |