test262/test/language/expressions/assignment/target-super-computed-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

38 lines
939 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-assignment-operators
description: Assignment Operator evaluates the value prior validating a SuperProperty's reference (null)
info: |
# 13.15.2 Runtime Semantics: Evaluation
AssignmentExpression : LeftHandSideExpression = AssignmentExpression
1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral,
then
a. Let lref be the result of evaluating LeftHandSideExpression.
[...]
e. Perform ? PutValue(lref, rval).
# 6.2.4.5 PutValue ( V, W )
[...]
5. If IsPropertyReference(V) is true, then
a. Let baseObj be ? ToObject(V.[[Base]]).
---*/
var count = 0;
class C {
static m() {
super[0] = count += 1;
}
}
Object.setPrototypeOf(C, null);
assert.throws(TypeError, function() {
C.m();
});
assert.sameValue(count, 1);