Skip to content

Should we allow super [ Expression ] in PatternMatchingMemberExpression? #331

Open

Description

@JLHwung

Here is the current PatternMatchingMemberExpression production:

PatternMatchingMemberExpression[Yield, Await] :
  this
  MetaProperty
  IdentifierReference[?Yield, ?Await]
  super . IdentifierName
  PatternMatchingMemberExpression[?Yield, ?Await] . IdentifierName
  PatternMatchingMemberExpression[?Yield, ?Await] . PrivateIdentifier
  PatternMatchingMemberExpression[?Yield, ?Await] [ Expression[+In, ?Yield, ?Await] ]

As we can see, the following examples are valid PatternMatchingMemberExpression:

  • this[expr]
  • super.prop[expr]
  • import.meta[expr]

However, this production does not cover super [ Expression[+In, ?Yield, ?Await] ], should we also include it?
If yes we can replace super . IdentifierName by the SuperProperty production, which already covers super[expr].

Activity

  1. ljharb commented on Jul 6, 2024

    @ljharb
    Member

    My expectation is that we’d match decorators here.

  2. Jack-Works commented on Jul 7, 2024

    @Jack-Works
    Member

    looks like I forgot that production

  3. Jack-Works commented on Jul 7, 2024

    @Jack-Works
    Member

    My expectation is that we’d match decorators here.

    DecoratorMemberExpression is too limited. It doesn't include this MetaProperty or super.*, it also includes (Expression) we don't want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions