UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

32 lines (30 loc) 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ts = require("typescript"); const errors = require("./../../errors"); const callBaseFill_1 = require("./../callBaseFill"); function AsyncableNode(Base) { return class extends Base { isAsync() { return this.hasModifier(ts.SyntaxKind.AsyncKeyword); } getAsyncKeyword() { return this.getFirstModifierByKind(ts.SyntaxKind.AsyncKeyword); } getAsyncKeywordOrThrow() { return errors.throwIfNullOrUndefined(this.getFirstModifierByKind(ts.SyntaxKind.AsyncKeyword), "Expected to find an async keyword."); } setIsAsync(value) { this.toggleModifier("async", value); return this; } fill(structure) { callBaseFill_1.callBaseFill(Base.prototype, this, structure); if (structure.isAsync != null) this.setIsAsync(structure.isAsync); return this; } }; } exports.AsyncableNode = AsyncableNode; //# sourceMappingURL=AsyncableNode.js.map