-
Notifications
You must be signed in to change notification settings - Fork 357
feature/Nullish coalescing operator and assignment #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
Conversation
saelo
left a comment
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.
Thanks!
It would be nice to also add support in the compiler for this. See #461 or similar PRs for examples. But also fine to land like this and maybe leave a TODO or file an issue :)
| return self.rawValue | ||
| } | ||
|
|
||
| static public func allCaseWithoutNCO() -> Array<BinaryOperator> { |
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.
What's the idea behind this? Why is the new operator special?
| case .BitwiseXor: | ||
| try translateBinaryOperation(.Xor) | ||
| case .NCO: | ||
| try translateBinaryOperation(.NCO) |
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.
You will also need to update the corresponding JavaScript code, see here:
| const OP_LOGICAL_NOT = 'LOGICAL_NOT'; |
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.
Thanks very much. I missed something here.
| case Exp = "**" | ||
| case UnRShift = ">>>" | ||
| // Nullish coalescing operator (??) | ||
| case NCO = "??" |
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.
'NCO' is maybe a little weird because none of the other operators have "operator" in their name. 'NC' is maybe a bit short/unintuitive though, so how about just calling it NullCoalesce?
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.
Good point. Thanks!
|
I guess this can be closed now after #471? If not, please reopen |
Add some feature about nullish coalescing operator and assignment