test262/test/language/statements/class/elements/privatefieldset-evaluation-order-3.js
André Bargull d00039593d Add various private field and private method tests
This adds tests for implementation bugs in SpiderMonkey [1], plus
additional tests for implementation bugs in V8 and JSC.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1723155
2021-08-04 15:06:38 -04:00

46 lines
978 B
JavaScript

// Copyright (C) 2021 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Evaluation order when resolving private fields.
esid: sec-runtime-semantics-keyeddestructuringassignmentevaluation
info: |
13.15.5.6 Runtime Semantics: KeyedDestructuringAssignmentEvaluation
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
b. ReturnIfAbrupt(lref).
2. Let v be ? GetV(value, propertyName).
3. ...
features: [class, class-fields-private]
---*/
class Base {
constructor(o) {
return o;
}
}
class C extends Base {
#field;
m() {
var init = () => new C(this);
var object = {
get a() {
init();
return "pass";
}
};
({a: this.#field} = object);
assert.sameValue(this.#field, "pass");
}
}
C.prototype.m.call({});