Contains gets around this by shunting to ComputedPropertyContains for a ClassTail. It looks like this was missed in ContainsArguments, which will incorrectly look for arguments in a FieldDefinition's initializer. In general this isn't a problem because that would be a static error anyways, but it does mean that ContainsArguments incorrectly and unnecessarily recurs through nested FieldDefinition declarations:
class A {
static B = class {
static C = class {
static D = arguments; // static error, but for `A`
}
}
}
In this case, ContainsArguments would descend all the way to D when checking the static semantics of A, B, and C, when only ContainsArguments for C really needs to do that descent. Instead, ContainsArguments should only check a ComputedPropertyName of the FieldDefinition. In the case where there's a static error, per the spec it would be incorrectly attributed to A and not C above.
If there's no static error, then ContainsArguments needlessly descends though the AST when it encounters the Initializer of a FieldDefinition:
class A {
static B = class {
static C = class {
static D = 0;
}
}
}
In this case, ContainsArguments descends all the way to D for A, B, and C, which would be a waste of processing time in a literal interpretation of the specification.
I suggest that ContainsArguments be amended to include this rule:
FieldDefinition : ClassElementName Initializer?
- Return ContainsArguments of ClassElementName.
Containsgets around this by shunting toComputedPropertyContainsfor a ClassTail. It looks like this was missed inContainsArguments, which will incorrectly look forargumentsin a FieldDefinition's initializer. In general this isn't a problem because that would be a static error anyways, but it does mean thatContainsArgumentsincorrectly and unnecessarily recurs through nested FieldDefinition declarations:In this case,
ContainsArgumentswould descend all the way toDwhen checking the static semantics ofA,B, andC, when onlyContainsArgumentsforCreally needs to do that descent. Instead,ContainsArgumentsshould only check a ComputedPropertyName of the FieldDefinition. In the case where there's a static error, per the spec it would be incorrectly attributed toAand notCabove.If there's no static error, then
ContainsArgumentsneedlessly descends though the AST when it encounters the Initializer of a FieldDefinition:In this case,
ContainsArgumentsdescends all the way toDforA,B, andC, which would be a waste of processing time in a literal interpretation of the specification.I suggest that
ContainsArgumentsbe amended to include this rule: