This seemingly valid CS code:
throw if pedantic
new FatalError
else
new ResumableError
Compiles to invalid JS:
throw if (pedantic) {
new FatalError;
} else {
new ResumableError;
};
I say seemingly valid because the same thing works for a function call:
raise = (e) -> throw e
raise if pedantic
new FatalError
else
new ResumableError
var raise;
raise = function(e) {
throw e;
};
raise(pedantic ? new FatalError : new ResumableError);