Add support for null coalescing (?? & ??=)#131
Add support for null coalescing (?? & ??=)#131gamerbross wants to merge 4 commits intoHaxeFoundation:masterfrom
?? & ??=)#131Conversation
hscript/Parser.hx
Outdated
| mk(ETernary( | ||
| mk(EBinop("==", mk(EIdent(tmp),pmin(e1),pmax(e1)), mk(EIdent("null"),pmin(e1),pmax(e1)))), | ||
| e2, | ||
| e1 |
There was a problem hiding this comment.
Shouldn't this be tmp to avoid code duplication?
There was a problem hiding this comment.
This also means that a relevant test is missing.
There was a problem hiding this comment.
i just made one and after the change runs successfully, but maybe pushing it would be a lot of code just for it that now works great. I had to make a new class with a integer variable with a getter function that increases everytime you access it
|
should be good now |
|
Is there any new about this? |
|
btw i just added support for |
?? & ??=)
|
You should do "??" + "=" since the c++ compiler converts ??= to a # |
The cpp tagert will break if you don't make this change .___. |
|
Any updates on this? This would be a great feature to have! |
|
Also up here, any chance to see "??" making its way to hscript? |
|
I think the cpp change should not be made inside the hscript code but inside the haxe compiler code. Please revert the cpp specific changes and open an issue in haxe compiler github. |
Nothing to explain :)