mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-03 21:24:30 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			737 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			737 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// Copyright (C) 2015 André Bargull. All rights reserved.
 | 
						|
// This code is governed by the BSD license found in the LICENSE file.
 | 
						|
 | 
						|
/*---
 | 
						|
info: Compound Assignment Operator evaluates its operands from left to right.
 | 
						|
description: >
 | 
						|
    The left-hand side expression is evaluated before the right-hand side.
 | 
						|
    Left-hand side expression is MemberExpression: base[prop]. Evaluating
 | 
						|
    ToPropertyKey(prop) throws an error.
 | 
						|
    Check operator is "x ^= y".
 | 
						|
---*/
 | 
						|
 | 
						|
function DummyError() { }
 | 
						|
 | 
						|
assert.throws(DummyError, function() {
 | 
						|
  var base = {};
 | 
						|
  var prop = {
 | 
						|
    toString: function() {
 | 
						|
      throw new DummyError();
 | 
						|
    }
 | 
						|
  };
 | 
						|
  var expr = function() {
 | 
						|
    $ERROR("right-hand side expression evaluated");
 | 
						|
  };
 | 
						|
 | 
						|
  base[prop] ^= expr();
 | 
						|
});
 |