-
Notifications
You must be signed in to change notification settings - Fork 628
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
[WIP] JavaScript: destructuring binding #3435
base: master
Are you sure you want to change the base?
[WIP] JavaScript: destructuring binding #3435
Conversation
2edf82b
to
732de02
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3435 +/- ##
==========================================
+ Coverage 85.37% 85.38% +0.01%
==========================================
Files 235 235
Lines 56458 56565 +107
==========================================
+ Hits 48200 48299 +99
- Misses 8258 8266 +8 ☔ View full report in Codecov by Sentry. |
732de02
to
ec3b205
Compare
Rebased on the latest master branch. |
@masatake Thanks for rebasing! I have had this one on my todo list for a while. I will try to get to it soon. |
It seems to be working to a limit. Deconstruction in a multilines block of code fails: files.push({
relative, // <----
basename: name,
absolute: loc,
mtime: +stat.mtime
}); I don't know if it is related but the following form fails as well: computed: {
...mapGetters([
'getAsylumAssistant',
'getModel',
'getType',
]),
}, I thought these forms would work but apparently not: this.stagedlocalRecord = { localRecord, localRecordIndex }
// ---
return this.saveData({ partyId, id, data, rubyType: dbTypes[type], jsType: type })
// ---
createDocketEntryModel ({ commit, state }, requestData) {
// ...
} And there might be more but it takes too long for me to check all the warnings 😅 |
@AdrienGiboire thank you.
I don't understand this. Is I cannot find the notation in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment. |
This assumes that
|
@jafl Thank you. So the question is, in which context can we use the shorthand syntax? |
Here it describes the case you're wondering about, especially this part:
Knowing that it should support default values.
Basically, if a variable is between |
ec3b205
to
3b52348
Compare
@AdrienGiboire Thank you.
I found even this input causes the warning message.
It seems that we must improve skipArgumentList(). I will inspect this one more. |
Could you provide an example input that node accepts? |
Did you mean to run |
You are correct. However, even though I specified /tmp/foo.js, I got an error.
|
You can try something like this: const embedded = { foo: 'bar' }
const something = {
...embedded,
baz: 'fox',
} |
Thank you. Based on your hit, I modified /tmp/foo.js:
Works fine. Thank you.
I cannot remember what we were talking about quickly. But I guess the issue is about |
I found two issues here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax |
It makes sense but at the same time would it not be legit to have the definition? For example, you can have something like:
It would make sense to have the definition of the function referenced. What do you think? |
This is a difficult question. However, regarding the example,
In my understanding, this is the same as:
Am I correct? The Added after commenting
My understanding may be correct. |
|
Surprisingly, the change for skipping spread operators works well with the current master branch. So I can submit it as a standalone pull request. |
Related to universal-ctags#3435. Signed-off-by: Masatake YAMATO <[email protected]>
Related to universal-ctags#3435. Signed-off-by: Masatake YAMATO <[email protected]>
This tells spread syntax. |
Pretty much, yes.
It does look good 👍
I'm not sure I understand what you mean. And I know nothing about Lisp so I can't relate ^^' I tried googling but I have not seen |
@AdrienGiboire Sorry, after rereading the page at developer.mozilla.org, "spread syntax" is the correct word. |
With this change, the parser skip "..." and the subsequent expression. ref. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax Related to universal-ctags#3435. Signed-off-by: Masatake YAMATO <[email protected]>
343d606
to
68ee390
Compare
@jafl, can I merge this? |
|
Close universal-ctags#1112. Signed-off-by: Masatake YAMATO <[email protected]>
Signed-off-by: Masatake YAMATO <[email protected]>
Signed-off-by: Masatake YAMATO <[email protected]>
… name: name, ...} Signed-off-by: Masatake YAMATO <[email protected]>
68ee390
to
501e14b
Compare
Close #1112.
Limitations:
If an object literal is specified as a default value in object restructuring, the parser may fail to extract the variable (or constant):
I will try to remove this limitation.
key
in[key]
is extracted unexpectedly.the parser fills the signature field for
userDisplayName
with a wrong value.f
is not tagged withfunction
kind.I will not try to fix this. I cannot find any easy way to remove this limitation.
ref. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment