UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

47 lines (46 loc) 2.04 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 expression_1 = require("./../expression"); var JsxExpression = /** @class */ (function (_super) { __extends(JsxExpression, _super); function JsxExpression() { return _super !== null && _super.apply(this, arguments) || this; } /** * Gets the dot dot dot token (...) or throws if it doesn't exist. */ JsxExpression.prototype.getDotDotDotTokenOrThrow = function () { return errors.throwIfNullOrUndefined(this.getDotDotDotToken(), "Expected to find a dot dot dot token for the JSX expression."); }; /** * Gets the dot dot dot token (...) or returns undefined if it doesn't exist. */ JsxExpression.prototype.getDotDotDotToken = function () { return this.getNodeFromCompilerNodeIfExists(this.compilerNode.dotDotDotToken); }; /** * Gets the expression or throws if it doesn't exist. */ JsxExpression.prototype.getExpressionOrThrow = function () { return errors.throwIfNullOrUndefined(this.getExpression(), "Expected to find an expression for the JSX expression."); }; /** * Gets the expression or returns undefined if it doesn't exist */ JsxExpression.prototype.getExpression = function () { return this.getNodeFromCompilerNodeIfExists(this.compilerNode.expression); }; return JsxExpression; }(expression_1.Expression)); exports.JsxExpression = JsxExpression;