summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/delete/member-identifier-reference-null.js
blob: 68c62e3ac23c5ddac9ed5508d5ba070a1f218a98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-delete-operator
description: Delete Operator throws an error if the base reference is not object-coercible (null).
info: |
  # 12.5.3.2 Runtime Semantics: Evaluation
  UnaryExpression : delete UnaryExpression

  [...]
  5. If IsPropertyReference(ref) is true, then
     a. If IsSuperReference(ref) is true, throw a ReferenceError exception.
     b. Let baseObj be ? ToObject(ref.[[Base]]).
---*/

var base = null;

assert.throws(TypeError, function() {
  delete base.prop;
});

reportCompare(0, 0);