summaryrefslogtreecommitdiff
path: root/test/language/expressions/compound-assignment/S11.13.2_A7.8_T1.js
blob: 4c4d65ad63fd6cb3ebf299ef304444c92fc71906 (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
30
31
32
33
34
35
36
37
38
39
// 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]. base is the
    null value.
    Check operator is "x >>>= y".
---*/

function DummyError() { }

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

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

assert.throws(TypeError, function() {
  var base = null;
  var prop = {
    toString: function() {
      $ERROR("property key evaluated");
    }
  };
  var expr = function() {
    $ERROR("right-hand side expression evaluated");
  };

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