Skip to content

Adding case to test invalid syntax when using PrivateName after '?.' #2408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/class-elements/grammar-private-field-optional-chaining.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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 after '?.' is not valid syntax
info: |
Updated Productions

MemberExpression[Yield]:
MemberExpression[?Yield].PrivateName
template: syntax/invalid
features: [class-fields-private, optional-chaining]
---*/

//- elements
#m = 'test262';

access(obj) {
return obj?.#m;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-private-field-optional-chaining.case
// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template
/*---
description: PrivateName after '?.' is not valid syntax (class expression)
esid: prod-ClassElement
features: [class-fields-private, optional-chaining, class]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
Updated Productions

MemberExpression[Yield]:
MemberExpression[?Yield].PrivateName

---*/


$DONOTEVALUATE();

var C = class {
#m = 'test262';

access(obj) {
return obj?.#m;
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-private-field-optional-chaining.case
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
/*---
description: PrivateName after '?.' is not valid syntax (class declaration)
esid: prod-ClassElement
features: [class-fields-private, optional-chaining, class]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
Updated Productions

MemberExpression[Yield]:
MemberExpression[?Yield].PrivateName

---*/


$DONOTEVALUATE();

class C {
#m = 'test262';

access(obj) {
return obj?.#m;
}
}