UNPKG

3.24 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 };
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15Object.defineProperty(exports, "__esModule", { value: true });
16exports.DocBlockTag = void 0;
17var DocNode_1 = require("./DocNode");
18var StringChecks_1 = require("../parser/StringChecks");
19var DocExcerpt_1 = require("./DocExcerpt");
20/**
21 * Represents a TSDoc block tag such as `@param` or `@public`.
22 */
23var DocBlockTag = /** @class */ (function (_super) {
24 __extends(DocBlockTag, _super);
25 /**
26 * Don't call this directly. Instead use {@link TSDocParser}
27 * @internal
28 */
29 function DocBlockTag(parameters) {
30 var _this = _super.call(this, parameters) || this;
31 StringChecks_1.StringChecks.validateTSDocTagName(parameters.tagName);
32 _this._tagName = parameters.tagName;
33 _this._tagNameWithUpperCase = parameters.tagName.toUpperCase();
34 if (DocNode_1.DocNode.isParsedParameters(parameters)) {
35 _this._tagNameExcerpt = new DocExcerpt_1.DocExcerpt({
36 configuration: _this.configuration,
37 excerptKind: DocExcerpt_1.ExcerptKind.BlockTag,
38 content: parameters.tagNameExcerpt
39 });
40 }
41 return _this;
42 }
43 Object.defineProperty(DocBlockTag.prototype, "kind", {
44 /** @override */
45 get: function () {
46 return DocNode_1.DocNodeKind.BlockTag;
47 },
48 enumerable: false,
49 configurable: true
50 });
51 Object.defineProperty(DocBlockTag.prototype, "tagName", {
52 /**
53 * The TSDoc tag name. TSDoc tag names start with an at-sign (`@`) followed
54 * by ASCII letters using "camelCase" capitalization.
55 */
56 get: function () {
57 return this._tagName;
58 },
59 enumerable: false,
60 configurable: true
61 });
62 Object.defineProperty(DocBlockTag.prototype, "tagNameWithUpperCase", {
63 /**
64 * The TSDoc tag name in all capitals, which is used for performing
65 * case-insensitive comparisons or lookups.
66 */
67 get: function () {
68 return this._tagNameWithUpperCase;
69 },
70 enumerable: false,
71 configurable: true
72 });
73 /** @override */
74 DocBlockTag.prototype.onGetChildNodes = function () {
75 return [this._tagNameExcerpt];
76 };
77 DocBlockTag.prototype.getTokenSequence = function () {
78 if (!this._tagNameExcerpt) {
79 throw new Error('DocBlockTag.getTokenSequence() failed because this object did not originate from a parsed input');
80 }
81 return this._tagNameExcerpt.content;
82 };
83 return DocBlockTag;
84}(DocNode_1.DocNode));
85exports.DocBlockTag = DocBlockTag;
86//# sourceMappingURL=DocBlockTag.js.map
\No newline at end of file