summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T3.js
blob: ce2fc1c204392c3aabb15c7a3abd7ed656d2a0b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 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]. ToPropertyKey(prop) is not called multiple
    times.
---*/

var propKeyEvaluated = false;
var base = {};
var prop = {
  toString: function() {
    assert(!propKeyEvaluated);
    propKeyEvaluated = true;
    return 1;
  }
};

base[prop]++;

reportCompare(0, 0);