UNPKG

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