keith_miller@apple.com | bcc77f2 | 2016-07-15 06:03:25 +0000 | [diff] [blame] | 1 | // Copyright (C) 2015 André Bargull. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | info: Operator --x evaluates its reference expression once. |
| 6 | description: > |
| 7 | The operand expression is evaluated exactly once. Operand expression is |
| 8 | MemberExpression: base[prop]. base is the undefined value. |
| 9 | ---*/ |
| 10 | |
| 11 | function DummyError() { } |
| 12 | |
| 13 | assert.throws(DummyError, function() { |
| 14 | var base = undefined; |
| 15 | var prop = function() { |
| 16 | throw new DummyError(); |
| 17 | }; |
| 18 | |
| 19 | --base[prop()]; |
| 20 | }); |
| 21 | |
| 22 | assert.throws(TypeError, function() { |
| 23 | var base = undefined; |
| 24 | var prop = { |
| 25 | toString: function() { |
| 26 | $ERROR("property key evaluated"); |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | --base[prop]; |
| 31 | }); |