| 1 |
// Copyright (C) 2014 André Bargull. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: Compound Assignment Operator calls PutValue(lref, v) |
| 6 |
es5id: S11.13.2_A6.6_T1 |
| 7 |
description: > |
| 8 |
Evaluating LeftHandSideExpression lref returns Reference type; Reference |
| 9 |
base value is an environment record and environment record kind is |
| 10 |
declarative environment record. PutValue(lref, v) uses the initially |
| 11 |
created Reference even if a more local binding is available. |
| 12 |
Check operator is "x <<= y". |
| 13 |
flags: [noStrict] |
| 14 |
---*/ |
| 15 |
|
| 16 |
function testCompoundAssignment() { |
| 17 |
var x = 1; |
| 18 |
var innerX = (function() { |
| 19 |
x <<= (eval("var x = 2;"), 3); |
| 20 |
return x; |
| 21 |
})(); |
| 22 |
|
| 23 |
if (innerX !== 2) { |
| 24 |
$ERROR('#1: innerX === 2. Actual: ' + (innerX)); |
| 25 |
} |
| 26 |
if (x !== 8) { |
| 27 |
$ERROR('#2: x === 8. Actual: ' + (x)); |
| 28 |
} |
| 29 |
} |
| 30 |
testCompoundAssignment(); |