UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for static analysis and code manipulation.

27 lines (26 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var Statement_1 = require("./Statement"); var errors = require("../../../errors"); exports.ThrowStatementBase = Statement_1.Statement; var ThrowStatement = /** @class */ (function (_super) { tslib_1.__extends(ThrowStatement, _super); function ThrowStatement() { return _super !== null && _super.apply(this, arguments) || this; } /** * Gets the throw statement's expression. */ ThrowStatement.prototype.getExpression = function () { return this._getNodeFromCompilerNodeIfExists(this.compilerNode.expression); }; /** * Gets the throw statement's expression or throws undefined if it doesn't exist. */ ThrowStatement.prototype.getExpressionOrThrow = function () { return errors.throwIfNullOrUndefined(this.getExpression(), "Expected to find the throw statement's expression."); }; return ThrowStatement; }(exports.ThrowStatementBase)); exports.ThrowStatement = ThrowStatement;