mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-04 05:33:50 +01:00 
			
		
		
		
	* Update test for o[p] = f() Update S11.13.1_A7_T3.js now that consensus has been reached on https://github.com/tc39/ecma262/pull/3307. * Rename test and add an analogous one for super.
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// Copyright (C) 2015 André Bargull. All rights reserved.
 | 
						|
// Copyright (C) 2024 Sony Interactive Entertainment Inc. All rights reserved.
 | 
						|
// This code is governed by the BSD license found in the LICENSE file.
 | 
						|
 | 
						|
/*---
 | 
						|
esid: sec-assignment-operators
 | 
						|
description: Assignment Operator evaluates its operands from left to right (formerly S11.13.1_A7_T3)
 | 
						|
info: |
 | 
						|
  The left-hand side expression is evaluated before the right-hand side.
 | 
						|
  Left-hand side expression is MemberExpression: base[prop].
 | 
						|
  ToPropertyKey(prop) occurs after both sides are evaluated.
 | 
						|
---*/
 | 
						|
 | 
						|
function DummyError() { }
 | 
						|
 | 
						|
assert.throws(DummyError, function() {
 | 
						|
  var base = {};
 | 
						|
  var prop = function() {
 | 
						|
    throw new DummyError();
 | 
						|
  };
 | 
						|
  var expr = function() {
 | 
						|
    throw new Test262Error("right-hand side expression evaluated");
 | 
						|
  };
 | 
						|
 | 
						|
  base[prop()] = expr();
 | 
						|
});
 | 
						|
 | 
						|
assert.throws(DummyError, function() {
 | 
						|
  var base = {};
 | 
						|
  var prop = {
 | 
						|
    toString: function() {
 | 
						|
      throw new Test262Error("property key evaluated");
 | 
						|
    }
 | 
						|
  };
 | 
						|
  var expr = function() {
 | 
						|
    throw new DummyError();
 | 
						|
  };
 | 
						|
 | 
						|
  base[prop] = expr();
 | 
						|
});
 |