mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-04 05:33:50 +01:00 
			
		
		
		
	The increment/decrement operator evaluates its operand expression once. When the operand expression is a property accessor, RequireObjectCoercible and ToPropertyKey are called on the property accessor in the correct order.
		
			
				
	
	
		
			32 lines
		
	
	
		
			707 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			707 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
// Copyright (C) 2015 André Bargull. All rights reserved.
 | 
						|
// This code is governed by the BSD license found in the LICENSE file.
 | 
						|
 | 
						|
/*---
 | 
						|
info: Operator x++ evaluates its reference expression once.
 | 
						|
description: >
 | 
						|
    The operand expression is evaluated exactly once. Operand expression is
 | 
						|
    MemberExpression: base[prop]. base is the undefined value.
 | 
						|
---*/
 | 
						|
 | 
						|
function DummyError() { }
 | 
						|
 | 
						|
assert.throws(DummyError, function() {
 | 
						|
  var base = undefined;
 | 
						|
  var prop = function() {
 | 
						|
    throw new DummyError();
 | 
						|
  };
 | 
						|
 | 
						|
  base[prop()]++;
 | 
						|
});
 | 
						|
 | 
						|
assert.throws(TypeError, function() {
 | 
						|
  var base = undefined;
 | 
						|
  var prop = {
 | 
						|
    toString: function() {
 | 
						|
      $ERROR("property key evaluated");
 | 
						|
    }
 | 
						|
  };
 | 
						|
 | 
						|
  base[prop]++;
 | 
						|
});
 |