test262/test/language/expressions/delete/member-identifier-reference-null.js
Mike Pennisi 9b4ca4371b Add tests for change in Reference Records
These tests support the following normative change

"Normative: Allow null or undefined in Reference Records"
https://github.com/tc39/ecma262/pull/2267

The tests concerning the `delete` operator increase coverage to verify
behavior which, though related, is not altered by the normative change.
These tests are intended to guard against regressions as engines
implement the new semantics.
2021-06-24 13:16:43 -04:00

22 lines
632 B
JavaScript

// 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;
});