-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
support optional chaining operator #533
Conversation
(js2-highlight-function-call (js2-current-token)) | ||
(js2-get-token) | ||
(let (args | ||
(pos (js2-node-pos pn))) | ||
(when use-optional-chaining-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 come this is needed for optional chaining, but not for normal chaining?
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.
See https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining
So now there two types of function call node, one is Test?.();
, the other is Test()
AST is like
function call token as parent token
function name token parameters token
optional chaining token could be converted to a boolean flag in funcall call node. This flag is used when executing AST. Since js2-mode
is just a parser to build the AST tree, optional chaining toke could be ignored in js2-parse-function-call
Could you add a NEWS entry? In NEWS.md, at the top. |
@dgutov , I updated pull request. |
updated |
@@ -8,6 +8,10 @@ | |||
`js2-jsx-mode`. | |||
* Using `js2-jsx-mode` will now trigger a warning in Emacs 27. | |||
|
|||
## 2019-08-14 | |||
|
|||
* Support for optional-chaining operator `?.` |
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.
Please put this under Next
.
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.
done
Thank you |
See https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining
and #506