summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js
blob: 4a4647f9c3b6a4e48ff5428f9177992c1e5e5d70 (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
40
41
42
43
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-object-environment-records-setmutablebinding-n-v-s
description: >
  Assignment Operator calls PutValue(lref, rval) (formerly S11.13.1_A5_T5)
info: |
  The concrete Environment Record method SetMutableBinding for object Environment
  Records attempts to set the value of the Environment Record's associated binding
  object's property whose name is the value of the argument N to the value of argument V.
  A property named N normally already exists but if it does not or is not currently writable,
  error handling is determined by the value of the Boolean argument S.

  Let stillExists be ? HasProperty(bindings, N).
  If stillExists is false and S is true, throw a ReferenceError exception.
flags: [noStrict]
---*/

var count = 0;
var global = this;

Object.defineProperty(this, "x", {
  configurable: true,
  value: 1
});

(function() {
  "use strict";
  assert.throws(ReferenceError, () => {
    count++;
    x = (delete global.x, 2);
    count++;
  });
  count++;
})();

assert.sameValue(count, 2);
assert(!('x' in this));
assert(!('x' in global));


reportCompare(0, 0);