Skip to content
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

[JavaScript] possible enhancement: distinguish uses of square brackets #324

Closed
jcberquist opened this issue Apr 28, 2016 · 4 comments
Closed
Labels
T: enhancement Improvement of existing language features

Comments

@jcberquist
Copy link
Contributor

With the addition of the after-identifier context, it looks to me like it is possible to distinguish the use of square brackets in a property accessor (or array index) and square brackets used to denote a literal array. Does that seem right? If so, is that something you would be interested in adding?

@wbond
Copy link
Member

wbond commented Apr 28, 2016

Yes, that seems like a reasonable addition. I'll likely be adding such support to C/C++ and PHP soon also since those are now in better shape for more context-specific enhancements.

@jcberquist
Copy link
Contributor Author

I added a commit that implements this on a basic level: https://github.com/jcberquist/Packages/commit/3240bcb5ea4162e5acc2a4a8c0efbc93adde9088

I didn't create a pull request because I wasn't sure of the scopes you wanted to use, or if this was a satisfactory way to go about it (especially since you plan to do the same in C/C++ and PHP).

@wbond wbond added the T: enhancement Improvement of existing language features label Jun 1, 2016
@keith-hall
Copy link
Collaborator

The scoping for this is being discussed here: #790

@Thom1729
Copy link
Collaborator

Thom1729 commented Apr 7, 2017

Counterexample to jcberquist@3240bcb:

1 /**/ [a]

The [a] is incorrectly scoped meta.array-literal.js. The cause is the same as #885.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: enhancement Improvement of existing language features
Projects
None yet
Development

No branches or pull requests

4 participants