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

This commit is contained in:
Caio Lima 2019-11-01 11:44:07 -03:00 committed by Leo Balter
parent 21195de94c
commit d89c2cd601
3 changed files with 78 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}
};

View File

@ -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;
}
}