CR feedback
This commit is contained in:
Родитель
03dcdda443
Коммит
057357be88
|
@ -4913,22 +4913,24 @@ namespace ts {
|
|||
|
||||
if (!documentation) {
|
||||
documentation = symbol.getDocumentationComment();
|
||||
if ((!documentation || documentation.length === 0) && symbol.flags & SymbolFlags.Property) {
|
||||
if (documentation.length === 0 && symbol.flags & SymbolFlags.Property) {
|
||||
// For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo`
|
||||
// there documentation comments might be attached to the right hand side symbol of their declarations.
|
||||
// The pattern of such special property access is that the parent symbol is the symbol of the file.
|
||||
if (symbol.parent && forEach(symbol.parent.declarations, declaration => declaration.kind === SyntaxKind.SourceFile)) {
|
||||
forEach(symbol.declarations, declaration => {
|
||||
if (declaration.parent && declaration.parent.kind === SyntaxKind.BinaryExpression) {
|
||||
const rhsSymbol = program.getTypeChecker().getSymbolAtLocation((<BinaryExpression>declaration.parent).right);
|
||||
if (rhsSymbol) {
|
||||
documentation = rhsSymbol.getDocumentationComment();
|
||||
if (documentation && documentation.length > 0) {
|
||||
return true;
|
||||
}
|
||||
for(const declaration of symbol.declarations) {
|
||||
if (!declaration.parent || declaration.parent.kind !== SyntaxKind.BinaryExpression) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const rhsSymbol = program.getTypeChecker().getSymbolAtLocation((<BinaryExpression>declaration.parent).right);
|
||||
if (rhsSymbol) {
|
||||
documentation = rhsSymbol.getDocumentationComment();
|
||||
if (documentation.length > 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче