UNPKG

8.18 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.DocMemberReference = void 0;
17var DocNode_1 = require("./DocNode");
18var DocExcerpt_1 = require("./DocExcerpt");
19/**
20 * A {@link DocDeclarationReference | declaration reference} includes a chain of
21 * member references represented using `DocMemberReference` nodes.
22 *
23 * @remarks
24 * For example, `example-library#ui.controls.Button.(render:static)` is a
25 * declaration reference that contains three member references:
26 * `ui`, `.controls`, and `.Button`, and `.(render:static)`.
27 */
28var DocMemberReference = /** @class */ (function (_super) {
29 __extends(DocMemberReference, _super);
30 /**
31 * Don't call this directly. Instead use {@link TSDocParser}
32 * @internal
33 */
34 function DocMemberReference(parameters) {
35 var _this = _super.call(this, parameters) || this;
36 if (DocNode_1.DocNode.isParsedParameters(parameters)) {
37 _this._hasDot = !!parameters.dotExcerpt;
38 if (parameters.dotExcerpt) {
39 _this._dotExcerpt = new DocExcerpt_1.DocExcerpt({
40 configuration: _this.configuration,
41 excerptKind: DocExcerpt_1.ExcerptKind.MemberReference_Dot,
42 content: parameters.dotExcerpt
43 });
44 }
45 if (parameters.spacingAfterDotExcerpt) {
46 _this._spacingAfterDotExcerpt = new DocExcerpt_1.DocExcerpt({
47 configuration: _this.configuration,
48 excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
49 content: parameters.spacingAfterDotExcerpt
50 });
51 }
52 if (parameters.leftParenthesisExcerpt) {
53 _this._leftParenthesisExcerpt = new DocExcerpt_1.DocExcerpt({
54 configuration: _this.configuration,
55 excerptKind: DocExcerpt_1.ExcerptKind.MemberReference_LeftParenthesis,
56 content: parameters.leftParenthesisExcerpt
57 });
58 }
59 if (parameters.spacingAfterLeftParenthesisExcerpt) {
60 _this._spacingAfterLeftParenthesisExcerpt = new DocExcerpt_1.DocExcerpt({
61 configuration: _this.configuration,
62 excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
63 content: parameters.spacingAfterLeftParenthesisExcerpt
64 });
65 }
66 if (parameters.spacingAfterMemberExcerpt) {
67 _this._spacingAfterMemberExcerpt = new DocExcerpt_1.DocExcerpt({
68 configuration: _this.configuration,
69 excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
70 content: parameters.spacingAfterMemberExcerpt
71 });
72 }
73 if (parameters.colonExcerpt) {
74 _this._colonExcerpt = new DocExcerpt_1.DocExcerpt({
75 excerptKind: DocExcerpt_1.ExcerptKind.MemberReference_Colon,
76 configuration: _this.configuration,
77 content: parameters.colonExcerpt
78 });
79 }
80 if (parameters.spacingAfterColonExcerpt) {
81 _this._spacingAfterColonExcerpt = new DocExcerpt_1.DocExcerpt({
82 configuration: _this.configuration,
83 excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
84 content: parameters.spacingAfterColonExcerpt
85 });
86 }
87 if (parameters.spacingAfterSelectorExcerpt) {
88 _this._spacingAfterSelectorExcerpt = new DocExcerpt_1.DocExcerpt({
89 configuration: _this.configuration,
90 excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
91 content: parameters.spacingAfterSelectorExcerpt
92 });
93 }
94 if (parameters.rightParenthesisExcerpt) {
95 _this._rightParenthesisExcerpt = new DocExcerpt_1.DocExcerpt({
96 configuration: _this.configuration,
97 excerptKind: DocExcerpt_1.ExcerptKind.MemberReference_RightParenthesis,
98 content: parameters.rightParenthesisExcerpt
99 });
100 }
101 if (parameters.spacingAfterRightParenthesisExcerpt) {
102 _this._spacingAfterRightParenthesisExcerpt = new DocExcerpt_1.DocExcerpt({
103 configuration: _this.configuration,
104 excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
105 content: parameters.spacingAfterRightParenthesisExcerpt
106 });
107 }
108 }
109 else {
110 _this._hasDot = parameters.hasDot;
111 }
112 _this._memberIdentifier = parameters.memberIdentifier;
113 _this._memberSymbol = parameters.memberSymbol;
114 _this._selector = parameters.selector;
115 return _this;
116 }
117 Object.defineProperty(DocMemberReference.prototype, "kind", {
118 /** @override */
119 get: function () {
120 return DocNode_1.DocNodeKind.MemberReference;
121 },
122 enumerable: false,
123 configurable: true
124 });
125 Object.defineProperty(DocMemberReference.prototype, "hasDot", {
126 /**
127 * True if this member reference is preceded by a dot (".") token.
128 * It should be false only for the first member in the chain.
129 */
130 get: function () {
131 return this._hasDot;
132 },
133 enumerable: false,
134 configurable: true
135 });
136 Object.defineProperty(DocMemberReference.prototype, "memberIdentifier", {
137 /**
138 * The identifier for the referenced member.
139 * @remarks
140 * Either `memberIdentifier` or `memberSymbol` may be specified, but not both.
141 */
142 get: function () {
143 return this._memberIdentifier;
144 },
145 enumerable: false,
146 configurable: true
147 });
148 Object.defineProperty(DocMemberReference.prototype, "memberSymbol", {
149 /**
150 * The ECMAScript 6 symbol expression, which may be used instead of an identifier
151 * to indicate the referenced member.
152 * @remarks
153 * Either `memberIdentifier` or `memberSymbol` may be specified, but not both.
154 */
155 get: function () {
156 return this._memberSymbol;
157 },
158 enumerable: false,
159 configurable: true
160 });
161 Object.defineProperty(DocMemberReference.prototype, "selector", {
162 /**
163 * A TSDoc selector, which may be optionally when the identifier or symbol is insufficient
164 * to unambiguously determine the referenced declaration.
165 */
166 get: function () {
167 return this._selector;
168 },
169 enumerable: false,
170 configurable: true
171 });
172 /** @override */
173 DocMemberReference.prototype.onGetChildNodes = function () {
174 return [
175 this._dotExcerpt,
176 this._spacingAfterDotExcerpt,
177 this._leftParenthesisExcerpt,
178 this._spacingAfterLeftParenthesisExcerpt,
179 this._memberIdentifier,
180 this._memberSymbol,
181 this._spacingAfterMemberExcerpt,
182 this._colonExcerpt,
183 this._spacingAfterColonExcerpt,
184 this._selector,
185 this._spacingAfterSelectorExcerpt,
186 this._rightParenthesisExcerpt,
187 this._spacingAfterRightParenthesisExcerpt
188 ];
189 };
190 return DocMemberReference;
191}(DocNode_1.DocNode));
192exports.DocMemberReference = DocMemberReference;
193//# sourceMappingURL=DocMemberReference.js.map
\No newline at end of file