From a6f2446e196d5e05496f9c2879345b9dc1109b78 Mon Sep 17 00:00:00 2001 From: jbhoosreddy Date: Tue, 9 Oct 2018 01:35:33 -0400 Subject: [PATCH] test: private method usage: calling private method --- src/class-elements/private-field-usage.case | 26 +++++++++++++++++++ .../private-method-getter-usage.case | 26 +++++++++++++++++++ src/class-elements/private-method-usage.case | 26 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 src/class-elements/private-field-usage.case create mode 100644 src/class-elements/private-method-getter-usage.case create mode 100644 src/class-elements/private-method-usage.case diff --git a/src/class-elements/private-field-usage.case b/src/class-elements/private-field-usage.case new file mode 100644 index 0000000000..5c5b9ba0ec --- /dev/null +++ b/src/class-elements/private-field-usage.case @@ -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); +} diff --git a/src/class-elements/private-method-getter-usage.case b/src/class-elements/private-method-getter-usage.case new file mode 100644 index 0000000000..59c0748a91 --- /dev/null +++ b/src/class-elements/private-method-getter-usage.case @@ -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); +} diff --git a/src/class-elements/private-method-usage.case b/src/class-elements/private-method-usage.case new file mode 100644 index 0000000000..a671359fbe --- /dev/null +++ b/src/class-elements/private-method-usage.case @@ -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); +}