mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Fixups for #6163.
This commit is contained in:
@@ -4280,25 +4280,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
// TODO (yuisu) : we should not have special cases to condition emitting comments
|
||||
// but have one place to fix check for these conditions.
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration &&
|
||||
node.kind !== SyntaxKind.MethodSignature &&
|
||||
node.parent &&
|
||||
node.parent.kind !== SyntaxKind.PropertyAssignment &&
|
||||
node.parent.kind !== SyntaxKind.CallExpression &&
|
||||
node.parent.kind !== SyntaxKind.ArrayLiteralExpression) {
|
||||
// 1. Methods will emit the comments as part of emitting method declaration
|
||||
|
||||
const { kind, parent } = node;
|
||||
if (kind !== SyntaxKind.MethodDeclaration &&
|
||||
kind !== SyntaxKind.MethodSignature &&
|
||||
parent &&
|
||||
parent.kind !== SyntaxKind.PropertyAssignment &&
|
||||
parent.kind !== SyntaxKind.CallExpression &&
|
||||
parent.kind !== SyntaxKind.ArrayLiteralExpression) {
|
||||
// 1. Methods will emit comments at their assignment declaration sites.
|
||||
//
|
||||
// 2. If the function is a property of object literal, emitting leading-comments
|
||||
// is done by emitNodeWithoutSourceMap which then call this function.
|
||||
// In particular, we would like to avoid emit comments twice in following case:
|
||||
// For example:
|
||||
// is done by emitNodeWithoutSourceMap which then call this function.
|
||||
// In particular, we would like to avoid emit comments twice in following case:
|
||||
//
|
||||
// var obj = {
|
||||
// id:
|
||||
// /*comment*/ () => void
|
||||
// }
|
||||
|
||||
//
|
||||
// 3. If the function is an argument in call expression, emitting of comments will be
|
||||
// taken care of in emit list of arguments inside of emitCallexpression
|
||||
// taken care of in emit list of arguments inside of 'emitCallExpression'.
|
||||
//
|
||||
// 4. If the function is in an array literal, 'emitLinePreservingList' will take care
|
||||
// of leading comments.
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
|
||||
@@ -4325,12 +4329,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
emitSignatureAndBody(node);
|
||||
if (modulekind !== ModuleKind.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) {
|
||||
if (modulekind !== ModuleKind.ES6 && kind === SyntaxKind.FunctionDeclaration && parent === currentSourceFile && node.name) {
|
||||
emitExportMemberAssignments((<FunctionDeclaration>node).name);
|
||||
}
|
||||
|
||||
emitEnd(node);
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
if (kind !== SyntaxKind.MethodDeclaration && kind !== SyntaxKind.MethodSignature) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user