blob: 7eec750dadb925c93fb13801f2394e1c51387412 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright (C) 2015 André Bargull. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5info: Operator --x evaluates its reference expression once.
6description: >
7 The operand expression is evaluated exactly once. Operand expression is
8 MemberExpression: base[prop]. base is the undefined value.
9---*/
10
11function DummyError() { }
12
13assert.throws(DummyError, function() {
14 var base = undefined;
15 var prop = function() {
16 throw new DummyError();
17 };
18
19 --base[prop()];
20});
21
22assert.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});