mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 23:14:47 +02:00
Added case to verify invalid syntax when using private field on object destructuring
This commit is contained in:
parent
185e590880
commit
b8e92c2341
@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (C) 2019 Caio Lima. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Acessing private field from object destructuring pattern is not a valid syntax
|
||||||
|
info: |
|
||||||
|
Updated Productions
|
||||||
|
|
||||||
|
ObjectAssignmentPattern[Yield, Await]:
|
||||||
|
{}
|
||||||
|
{AssignmentRestProperty[?Yield, ?Await]}
|
||||||
|
{AssignmentPropertyList[?Yield, ?Await]}
|
||||||
|
{AssignmentPropertyList[?Yield, ?Await],AssignmentRestProperty[?Yield, ?Await]opt}
|
||||||
|
template: syntax/invalid
|
||||||
|
features: [class-fields-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
#x = 1;
|
||||||
|
|
||||||
|
destructureX() {
|
||||||
|
const { #x: x } = this;
|
||||||
|
return x;
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-elements/grammar-private-field-on-object-destructuring.case
|
||||||
|
// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template
|
||||||
|
/*---
|
||||||
|
description: Acessing private field from object destructuring pattern is not a valid syntax (class expression)
|
||||||
|
esid: prod-ClassElement
|
||||||
|
features: [class-fields-private, class]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Updated Productions
|
||||||
|
|
||||||
|
ObjectAssignmentPattern[Yield, Await]:
|
||||||
|
{}
|
||||||
|
{AssignmentRestProperty[?Yield, ?Await]}
|
||||||
|
{AssignmentPropertyList[?Yield, ?Await]}
|
||||||
|
{AssignmentPropertyList[?Yield, ?Await],AssignmentRestProperty[?Yield, ?Await]opt}
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
#x = 1;
|
||||||
|
|
||||||
|
destructureX() {
|
||||||
|
const { #x: x } = this;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,33 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-elements/grammar-private-field-on-object-destructuring.case
|
||||||
|
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
|
||||||
|
/*---
|
||||||
|
description: Acessing private field from object destructuring pattern is not a valid syntax (class declaration)
|
||||||
|
esid: prod-ClassElement
|
||||||
|
features: [class-fields-private, class]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Updated Productions
|
||||||
|
|
||||||
|
ObjectAssignmentPattern[Yield, Await]:
|
||||||
|
{}
|
||||||
|
{AssignmentRestProperty[?Yield, ?Await]}
|
||||||
|
{AssignmentPropertyList[?Yield, ?Await]}
|
||||||
|
{AssignmentPropertyList[?Yield, ?Await],AssignmentRestProperty[?Yield, ?Await]opt}
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
class C {
|
||||||
|
#x = 1;
|
||||||
|
|
||||||
|
destructureX() {
|
||||||
|
const { #x: x } = this;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user