blob: 31a4b01b95c041eb89d947e30dd2592197b467e0 [file] [log] [blame] [edit]
// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: PrivateName of private setter is visible on inner function of class scope
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
template: default
features: [class-methods-private]
---*/
//- elements
set #m(v) { this._v = v; }
method() {
let self = this;
function innerFunction() {
self.#m = 'Test262';
}
innerFunction();
}
//- assertions
let c = new C();
c.method();
assert.sameValue(c._v, 'Test262');
let o = {};
assert.throws(TypeError, function() {
c.method.call(o);
}, 'accessed private setter from an ordinary object');