-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing coverage: computed properties as shorthand props #1202
Comments
Summary: `({0})` is not valid. the PropertyDefinition is not a valid IdentifierReference because it's a number literal, nor is it a valid PropertyName because there is no value. see also tc39/test262#1202 Reviewed By: gabelevi Differential Revision: D5732586 fbshipit-source-id: a6bd2817ccba9463692fa94e64e2bdc1a64b735b
While I might agree with verifying This might scale to the uncertainty of every possibility we can use to match. This doesn't mean I'm against this, I'll try my best to make a fit for these cases into Test262, somehow I want to add them to this test suite. |
yeah, agreed that it's not reasonable to test random invalid stuff. i think the only justification here is that it's a valid computed property key when it's followed by a value, but not alone. things that are neither valid keys nor valid shorthand seem definitely out of scope. I won't be upset if you just close this, though. |
I think I can do this. Starting from https://tc39.github.io/ecma262/#prod-ObjectLiteral:
we need to distinguish PropertyName - that requires being followed by an AssignmentExpression - from an restricted IdentifierReference. |
The Flow parser incorrectly allowed object literals like
{0}
and{[x]}
because it parsed the property's key and treated it as a shorthand definition when it didn't find a value.The first case is covered already, the latter seems not to be. On one hand, it's not reasonable to test every bogus thing someone could write, but I think this one is worth testing because it's so similar to other property keys.
The text was updated successfully, but these errors were encountered: