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
Add explicit braced property access parsing #260
Conversation
this.readTo(']') | ||
return new PropertyAccessToken(prop, [], this.p) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about ["foo"]["bar"]
or ["foo"].bar
?
We need adapt the following logic (the PropertyAccessToken
part) to support this case (remove the variable
constructor argument and make it the first props maybe?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, although the number of potential valid syntaxes are getting a bit scary. Do you think that could be postponed into the future and this feature shipped as is (once I fix the tests passing)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the number of potential valid syntaxes are getting a bit scary
Seems it can be done by consume the [
, call readValue recursively(as in props brackets), and consume the ]
. This way the following cases will be supported also:
{{["foo"].bar}}
{{[0].bar}}
{{[key].bar}}
🎉 This PR is included in version 9.16.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Parses braced property accesses similar to how Ruby Liquid does it. Fixes #259