Spaces:
Running
Running
File size: 6,692 Bytes
6abff73 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | "use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocMemberReference = void 0;
const DocNode_1 = require("./DocNode");
const DocExcerpt_1 = require("./DocExcerpt");
/**
* A {@link DocDeclarationReference | declaration reference} includes a chain of
* member references represented using `DocMemberReference` nodes.
*
* @remarks
* For example, `example-library#ui.controls.Button.(render:static)` is a
* declaration reference that contains three member references:
* `ui`, `.controls`, and `.Button`, and `.(render:static)`.
*/
class DocMemberReference extends DocNode_1.DocNode {
/**
* Don't call this directly. Instead use {@link TSDocParser}
* @internal
*/
constructor(parameters) {
super(parameters);
if (DocNode_1.DocNode.isParsedParameters(parameters)) {
this._hasDot = !!parameters.dotExcerpt;
if (parameters.dotExcerpt) {
this._dotExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.MemberReference_Dot,
content: parameters.dotExcerpt
});
}
if (parameters.spacingAfterDotExcerpt) {
this._spacingAfterDotExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
content: parameters.spacingAfterDotExcerpt
});
}
if (parameters.leftParenthesisExcerpt) {
this._leftParenthesisExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.MemberReference_LeftParenthesis,
content: parameters.leftParenthesisExcerpt
});
}
if (parameters.spacingAfterLeftParenthesisExcerpt) {
this._spacingAfterLeftParenthesisExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
content: parameters.spacingAfterLeftParenthesisExcerpt
});
}
if (parameters.spacingAfterMemberExcerpt) {
this._spacingAfterMemberExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
content: parameters.spacingAfterMemberExcerpt
});
}
if (parameters.colonExcerpt) {
this._colonExcerpt = new DocExcerpt_1.DocExcerpt({
excerptKind: DocExcerpt_1.ExcerptKind.MemberReference_Colon,
configuration: this.configuration,
content: parameters.colonExcerpt
});
}
if (parameters.spacingAfterColonExcerpt) {
this._spacingAfterColonExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
content: parameters.spacingAfterColonExcerpt
});
}
if (parameters.spacingAfterSelectorExcerpt) {
this._spacingAfterSelectorExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
content: parameters.spacingAfterSelectorExcerpt
});
}
if (parameters.rightParenthesisExcerpt) {
this._rightParenthesisExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.MemberReference_RightParenthesis,
content: parameters.rightParenthesisExcerpt
});
}
if (parameters.spacingAfterRightParenthesisExcerpt) {
this._spacingAfterRightParenthesisExcerpt = new DocExcerpt_1.DocExcerpt({
configuration: this.configuration,
excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
content: parameters.spacingAfterRightParenthesisExcerpt
});
}
}
else {
this._hasDot = parameters.hasDot;
}
this._memberIdentifier = parameters.memberIdentifier;
this._memberSymbol = parameters.memberSymbol;
this._selector = parameters.selector;
}
/** @override */
get kind() {
return DocNode_1.DocNodeKind.MemberReference;
}
/**
* True if this member reference is preceded by a dot (".") token.
* It should be false only for the first member in the chain.
*/
get hasDot() {
return this._hasDot;
}
/**
* The identifier for the referenced member.
* @remarks
* Either `memberIdentifier` or `memberSymbol` may be specified, but not both.
*/
get memberIdentifier() {
return this._memberIdentifier;
}
/**
* The ECMAScript 6 symbol expression, which may be used instead of an identifier
* to indicate the referenced member.
* @remarks
* Either `memberIdentifier` or `memberSymbol` may be specified, but not both.
*/
get memberSymbol() {
return this._memberSymbol;
}
/**
* A TSDoc selector, which may be optionally when the identifier or symbol is insufficient
* to unambiguously determine the referenced declaration.
*/
get selector() {
return this._selector;
}
/** @override */
onGetChildNodes() {
return [
this._dotExcerpt,
this._spacingAfterDotExcerpt,
this._leftParenthesisExcerpt,
this._spacingAfterLeftParenthesisExcerpt,
this._memberIdentifier,
this._memberSymbol,
this._spacingAfterMemberExcerpt,
this._colonExcerpt,
this._spacingAfterColonExcerpt,
this._selector,
this._spacingAfterSelectorExcerpt,
this._rightParenthesisExcerpt,
this._spacingAfterRightParenthesisExcerpt
];
}
}
exports.DocMemberReference = DocMemberReference;
//# sourceMappingURL=DocMemberReference.js.map |