mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Use getJsDocFromText to get trailing comments
Also update a couple of missed spots in the previous undo commits
This commit is contained in:
parent
ff9ccc9b05
commit
643cf302c6
@ -8288,11 +8288,7 @@ const _super = (function (geti, seti) {
|
||||
emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments);
|
||||
|
||||
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
|
||||
// However, a leading mid-line comment of the end of file token is emitted with spaces before,
|
||||
// as if it were a trailing comment of the previous token
|
||||
const commentStartsInMidLine = leadingComments && leadingComments.length && leadingComments[0].pos - 1 > 0 && currentText.charCodeAt(leadingComments[0].pos - 1) !== 10;
|
||||
const isEndOfFile = node.kind === SyntaxKind.EndOfFileToken && commentStartsInMidLine;
|
||||
emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ !isEndOfFile, newLine, writeComment);
|
||||
emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment);
|
||||
}
|
||||
|
||||
function emitTrailingComments(node: Node) {
|
||||
|
||||
@ -652,7 +652,7 @@ namespace ts {
|
||||
|
||||
|
||||
function addJSDocComment<T extends Node>(node: T): T {
|
||||
const comments = getLeadingCommentRangesOfNode(node, sourceFile);
|
||||
const comments = getJsDocCommentsFromText(node, sourceFile.text);
|
||||
if (comments) {
|
||||
for (const comment of comments) {
|
||||
const jsDoc = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);
|
||||
|
||||
@ -18,4 +18,4 @@ var Foo = (function () {
|
||||
var baz = Foo.b;
|
||||
// Foo.b won't bind.
|
||||
baz.concat("y");
|
||||
// So we don't want an error on 'concat'.
|
||||
// So we don't want an error on 'concat'.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user