summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T3.js
blob: 331ca21c1c727b67b12f8919531fe0503433f579 (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
25
26
27
28
29
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
    The left-hand side expression is evaluated before the right-hand side.
    Left-hand side expression is MemberExpression: base[prop]. Evaluating
    ToPropertyKey(prop) throws an error.
    Check operator is "x -= y".
---*/

function DummyError() { }

assert.throws(DummyError, function() {
  var base = {};
  var prop = {
    toString: function() {
      throw new DummyError();
    }
  };
  var expr = function() {
    throw new Test262Error("right-hand side expression evaluated");
  };

  base[prop] -= expr();
});

reportCompare(0, 0);