Debian Codegraph @

js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T3.js

raw
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]. ToPropertyKey(prop) is not called multiple
9 times.
10 ---*/
11
12 var propKeyEvaluated = false;
13 var base = {};
14 var prop = {
15 toString: function() {
16 assert(!propKeyEvaluated);
17 propKeyEvaluated = true;
18 return 1;
19 }
20 };
21
22 base[prop]--;
23
24 reportCompare(0, 0);