mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
Fix crash in emitTokenWithComment (#36542)
This commit is contained in:
@@ -2744,11 +2744,11 @@ namespace ts {
|
||||
const node = getParseTreeNode(contextNode);
|
||||
const isSimilarNode = node && node.kind === contextNode.kind;
|
||||
const startPos = pos;
|
||||
if (isSimilarNode) {
|
||||
pos = skipTrivia(currentSourceFile!.text, pos);
|
||||
if (isSimilarNode && currentSourceFile) {
|
||||
pos = skipTrivia(currentSourceFile.text, pos);
|
||||
}
|
||||
if (emitLeadingCommentsOfPosition && isSimilarNode && contextNode.pos !== startPos) {
|
||||
const needsIndent = indentLeading && !positionsAreOnSameLine(startPos, pos, currentSourceFile!);
|
||||
const needsIndent = indentLeading && currentSourceFile && !positionsAreOnSameLine(startPos, pos, currentSourceFile);
|
||||
if (needsIndent) {
|
||||
increaseIndent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user