tc39/proposal-decorators

Should @this.dec be allowed?

Opened this issue · 1 comments

The current syntax

DecoratorMemberExpression[Yield, Await] :
  IdentifierReference[?Yield, ?Await]
  DecoratorMemberExpression[?Yield, ?Await] . IdentifierName
  DecoratorMemberExpression[?Yield, ?Await] . PrivateIdentifier
  ( Expression[+In, ?Yield, ?Await] )

disallows this.dec as a decorator member expression, instead one would have to parenthesize it into @(this.dec).

Ref: #435 (comment), #435 (comment)

A related question: Should @this be allowed? I think we should either allow both or disallow both.

The receiver (and super, and arguments, and new.target) shouldn’t be treated any differently than any other identifier, ideally.