UNPKG

dgeni-packages

Version:

A collection of dgeni packages for generating documentation from source code

43 lines 2.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MemberDoc = void 0; /* tslint:disable:no-bitwise */ const typescript_1 = require("typescript"); const FileInfo_1 = require("../services/TsParser/FileInfo"); const getAccessibility_1 = require("../services/TsParser/getAccessibility"); const getDeclarationTypeText_1 = require("../services/TsParser/getDeclarationTypeText"); const getDecorators_1 = require("../services/TsParser/getDecorators"); /** * This document represents a member of a ClassLikeExportDoc. */ class MemberDoc { constructor(host, containerDoc, symbol, declaration) { this.host = host; this.containerDoc = containerDoc; this.symbol = symbol; this.declaration = declaration; this.docType = 'member'; this.path = ''; this.outputPath = ''; this.content = this.host.getContent(this.declaration); this.basePath = this.containerDoc.basePath; this.fileInfo = new FileInfo_1.FileInfo(this.declaration, this.basePath); this.startingLine = this.fileInfo.location.start.line + (this.fileInfo.location.start.character ? 1 : 0); this.endingLine = this.fileInfo.location.end.line; this.typeChecker = this.containerDoc.typeChecker; this.moduleDoc = this.containerDoc.moduleDoc; this.accessibility = (0, getAccessibility_1.getAccessibility)(this.declaration); this.decorators = (0, getDecorators_1.getDecorators)(this.declaration); this.type = (0, getDeclarationTypeText_1.getDeclarationTypeText)(this.declaration); this.isOptional = !!(this.symbol.flags & typescript_1.SymbolFlags.Optional); this.isGetAccessor = !!(this.symbol.flags & typescript_1.SymbolFlags.GetAccessor); this.isSetAccessor = !!(this.symbol.flags & typescript_1.SymbolFlags.SetAccessor); this.isCallMember = !!(this.symbol.flags & typescript_1.SymbolFlags.Signature && this.symbol.name === '__call'); this.isNewMember = !!(this.symbol.flags & typescript_1.SymbolFlags.Signature && this.symbol.name === '__new'); this.isReadonly = !!this.declaration.modifiers && this.declaration.modifiers.some(modifier => modifier.kind === typescript_1.SyntaxKind.ReadonlyKeyword); this.isAbstract = !!this.declaration.modifiers && this.declaration.modifiers.some(modifier => modifier.kind === typescript_1.SyntaxKind.AbstractKeyword); this.isStatic = !!this.declaration.modifiers && this.declaration.modifiers.some(modifier => modifier.kind === typescript_1.SyntaxKind.StaticKeyword); } } exports.MemberDoc = MemberDoc; //# sourceMappingURL=MemberDoc.js.map