cream-and-sugar
Version:
A deliciously functional syntax for JavaScript with native support for JSX
15 lines (13 loc) • 311 B
JavaScript
import { compile, nodes, compileBody } from '../utils';
/*
* Handle trye/catch
*/
compile(nodes.TryCatchNode, function () {
return `(function () {
try {
${compileBody(this.attempt)};
} catch (${this.errName.compile(true)}) {
${compileBody(this.fallback)};
}
}.bind(this)())`;
});