UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

26 lines (24 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AsExpressionCompiler = void 0; const tslib_1 = require("tslib"); const ts_utils_1 = require("@neo-one/ts-utils"); const typescript_1 = tslib_1.__importDefault(require("typescript")); const NodeCompiler_1 = require("../NodeCompiler"); class AsExpressionCompiler extends NodeCompiler_1.NodeCompiler { constructor() { super(...arguments); this.kind = typescript_1.default.SyntaxKind.AsExpression; } visitNode(sb, expr, options) { const type = sb.context.analysis.getType(expr, { error: false }); if (options.cast !== undefined && type === undefined) { sb.visit(ts_utils_1.tsUtils.expression.getExpression(expr), options); } else { sb.visit(ts_utils_1.tsUtils.expression.getExpression(expr), sb.castOptions(options, type)); } } } exports.AsExpressionCompiler = AsExpressionCompiler; //# sourceMappingURL=AsExpressionCompiler.js.map