mirror of
https://github.com/tc39/test262.git
synced 2025-12-09 23:09:54 +01:00
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
// 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 field 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-fields-private]
|
|
---*/
|
|
|
|
//- elements
|
|
#f = 'Test262';
|
|
|
|
method() {
|
|
let self = this;
|
|
function innerFunction() {
|
|
return self.#f;
|
|
}
|
|
|
|
return innerFunction();
|
|
}
|
|
//- assertions
|
|
let c = new C();
|
|
assert.sameValue(c.method(), 'Test262');
|
|
let o = {};
|
|
assert.throws(TypeError, function() {
|
|
c.method.call(o);
|
|
}, 'accessed private field from an ordinary object');
|