@neo-one/smart-contract-compiler
Version:
NEO•ONE TypeScript smart contract compiler.
22 lines (20 loc) • 673 B
JavaScript
import { tsUtils } from '@neo-one/ts-utils';
import ts from 'typescript';
import { NodeCompiler } from '../NodeCompiler';
export class ThrowStatementCompiler extends NodeCompiler {
constructor() {
super(...arguments);
this.kind = ts.SyntaxKind.ThrowStatement;
}
visitNode(sb, node, options) {
const expr = tsUtils.expression.getExpression(node);
if (expr === undefined) {
sb.context.reportUnsupported(node);
}
else {
sb.visit(expr, sb.pushValueOptions(options));
}
sb.emitHelper(node, options, sb.helpers.throw);
}
}
//# sourceMappingURL=ThrowStatementCompiler.js.map