mirror of
https://github.com/tc39/test262.git
synced 2025-07-29 17:04:31 +02:00
test: private method usage: calling private method
This commit is contained in:
parent
ecb5fcbe33
commit
a6f2446e19
26
src/class-elements/private-field-usage.case
Normal file
26
src/class-elements/private-field-usage.case
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (C) 2018 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: PrivateName CallExpression usage (private field)
|
||||||
|
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: syntax/valid
|
||||||
|
features: [class-methods-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
#m = 1;
|
||||||
|
method() {
|
||||||
|
assert.sameValue(this.#m, 1);
|
||||||
|
}
|
26
src/class-elements/private-method-getter-usage.case
Normal file
26
src/class-elements/private-method-getter-usage.case
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (C) 2018 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: PrivateName CallExpression usage (Accesor get method)
|
||||||
|
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: syntax/valid
|
||||||
|
features: [class-methods-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
get #m() { return 1; }
|
||||||
|
method() {
|
||||||
|
assert.sameValue(this.#m, 1);
|
||||||
|
}
|
26
src/class-elements/private-method-usage.case
Normal file
26
src/class-elements/private-method-usage.case
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (C) 2018 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: PrivateName CallExpression usage (private method)
|
||||||
|
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: syntax/valid
|
||||||
|
features: [class-methods-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
#m() { return 1; }
|
||||||
|
method() {
|
||||||
|
assert.sameValue(this.#m(), 1);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user