Skip to content
Snippets Groups Projects
Commit b8e92c23 authored by Caio Lima's avatar Caio Lima Committed by Rick Waldron
Browse files

Added case to verify invalid syntax when using private field on object destructuring

parent 185e5908
No related branches found
No related tags found
No related merge requests found
// 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;
}
// 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;
}
};
// 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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment