We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
that
This code:
-> | foo? => 42
Produces this compiled output:
// Generated by LiveScript 1.4.0 (function(){ switch (false) { case typeof foo == 'undefined' || foo === null: return 42; } });
However, if you mention that in the return clause:
-> | foo? => that
It will compile to this:
// Generated by LiveScript 1.4.0 (function(){ var that; switch (false) { case (that = foo) == null: return that; } });
Note missing checks for foo existence, so this code will die with ReferenceError when foo is not defined, and it shouldn't happen.
foo
ReferenceError
The text was updated successfully, but these errors were encountered:
Indeed this can be seen even more easily like this:
if a? console.log that # => ReferenceError
PR #895 might fix this.
if a? console.log that
var that; if (typeof a != 'undefined' && a !== null && (that = a, true)) { console.log(that); }
if not a? console.log that
var that; if ((that = undefined) || typeof a == 'undefined' || a === null) { console.log(that); }
a = 10 if a? console.log that
var a; a = 10; if ((that = a) != null) { console.log(that); }
a = 10 if not a? console.log that
var a; a = 10; if ((that = a) == null) { console.log(that); }
The switch and while variants should work as well, and forms such as
if a? and not b? that
work the same as before I believe.
Any other cases to think about? :)
Sorry, something went wrong.
No branches or pull requests
This code:
Produces this compiled output:
However, if you mention
that
in the return clause:It will compile to this:
Note missing checks for
foo
existence, so this code will die withReferenceError
whenfoo
is not defined, and it shouldn't happen.The text was updated successfully, but these errors were encountered: