-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for asi between
get
field and generator
- Loading branch information
1 parent
5dc04b7
commit cc87cdf
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...atements/class/elements/syntax/valid/grammar-field-named-get-followed-by-generator-asi.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: ASI between a field named "get" and a generator method | ||
esid: prod-ClassElement | ||
features: [class-fields-public, class] | ||
info: | | ||
ClassElement : | ||
MethodDefinition | ||
FieldDefinition ; | ||
static FieldDefinition ; | ||
; | ||
MethodDefinition : | ||
GeneratorMethod : | ||
get ClassElementName () { FunctionBody } | ||
GeneratorMethod : | ||
* ClassElementName ( UniqueFormalParameters ) { GeneratorBody } | ||
FieldDefinition : | ||
ClassElementName Initializer _opt | ||
ClassElementName : | ||
PropertyName | ||
PrivateName | ||
PropertyName : | ||
LiteralPropertyName | ||
ComputedPropertyName | ||
LiteralPropertyName : | ||
IdentifierName | ||
StringLiteral | ||
NumericLiteral | ||
---*/ | ||
|
||
class A { | ||
get | ||
*a() {} | ||
} | ||
|
||
class B { | ||
static get | ||
*a() {} | ||
} | ||
|
||
assert( | ||
A.prototype.hasOwnProperty("a"), | ||
"(A) The generator is installed on the prototype" | ||
); | ||
assert( | ||
new A().hasOwnProperty("get"), | ||
"(A) The field is installed on class instances" | ||
); | ||
assert( | ||
B.prototype.hasOwnProperty("a"), | ||
"(B) The generator is installed on the prototype" | ||
); | ||
assert( | ||
B.hasOwnProperty("get"), | ||
"(B) The field is installed on class" | ||
); |