test: private method usage: calling private method

This commit is contained in:
jbhoosreddy 2018-10-09 01:35:33 -04:00 committed by Rick Waldron
parent ecb5fcbe33
commit a6f2446e19
3 changed files with 78 additions and 0 deletions

View 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);
}

View 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);
}

View 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);
}