decaffeinate-parser
Version:
A better AST for CoffeeScript, inspired by CoffeeScriptRedux.
9 lines (8 loc) • 598 B
JavaScript
import { Try } from '../nodes';
import getLocation from '../util/getLocation';
import mapAny from './mapAny';
import mapPossiblyEmptyBlock from './mapPossiblyEmptyBlock';
export default function mapTry(context, node) {
var _a = getLocation(context, node), line = _a.line, column = _a.column, start = _a.start, end = _a.end, raw = _a.raw;
return new Try(line, column, start, end, raw, mapPossiblyEmptyBlock(context, node.attempt), node.errorVariable ? mapAny(context, node.errorVariable) : null, mapPossiblyEmptyBlock(context, node.recovery), mapPossiblyEmptyBlock(context, node.ensure));
}