Skip to content

Commit

Permalink
Add test for asi between get field and generator
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Aug 7, 2024
1 parent 5dc04b7 commit cc87cdf
Showing 1 changed file with 63 additions and 0 deletions.
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"
);

0 comments on commit cc87cdf

Please sign in to comment.