UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

42 lines (41 loc) 1.74 kB
"use strict"; var __extends = (this && this.__extends)/* istanbul ignore next */ || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var errors = require("./../../errors"); var common_1 = require("../common"); exports.CatchClauseBase = common_1.Node; var CatchClause = /** @class */ (function (_super) { __extends(CatchClause, _super); function CatchClause() { return _super !== null && _super.apply(this, arguments) || this; } /** * Gets this catch clause's block. */ CatchClause.prototype.getBlock = function () { return this.getNodeFromCompilerNode(this.compilerNode.block); }; /** * Gets this catch clause's variable declaration or undefined if none exists. */ CatchClause.prototype.getVariableDeclaration = function () { return this.getNodeFromCompilerNodeIfExists(this.compilerNode.variableDeclaration); }; /** * Gets this catch clause's variable declaration or throws if none exists. */ CatchClause.prototype.getVariableDeclarationOrThrow = function () { return errors.throwIfNullOrUndefined(this.getVariableDeclaration(), "Expected to find a variable declaration."); }; return CatchClause; }(exports.CatchClauseBase)); exports.CatchClause = CatchClause;