UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

21 lines (19 loc) 712 B
import { tsUtils } from '@neo-one/ts-utils'; import ts from 'typescript'; import { NodeCompiler } from '../NodeCompiler'; export class AsExpressionCompiler extends NodeCompiler { constructor() { super(...arguments); this.kind = ts.SyntaxKind.AsExpression; } visitNode(sb, expr, options) { const type = sb.context.analysis.getType(expr, { error: false }); if (options.cast !== undefined && type === undefined) { sb.visit(tsUtils.expression.getExpression(expr), options); } else { sb.visit(tsUtils.expression.getExpression(expr), sb.castOptions(options, type)); } } } //# sourceMappingURL=AsExpressionCompiler.js.map