Fix the incorrectly assigned arrow expression trailing comments
Fixes #8041
This commit is contained in:
parent
cefe39c56b
commit
10616560da
3 changed files with 7 additions and 5 deletions
|
@ -1505,8 +1505,11 @@ const _super = (function (geti, seti) {
|
|||
const endingLine = writer.getLine();
|
||||
emitLexicalEnvironment(endLexicalEnvironment(), /*newLine*/ startingLine !== endingLine);
|
||||
|
||||
const range = collapseRangeToEnd(body.statements);
|
||||
emitLeadingComments(range, getLeadingComments(range));
|
||||
// Do not emit leading comments if the body belongs to arrow expression
|
||||
if (!body.original || isBlock(body.original)) {
|
||||
const range = collapseRangeToEnd(body.statements);
|
||||
emitLeadingComments(range, getLeadingComments(range));
|
||||
}
|
||||
decreaseIndent();
|
||||
}
|
||||
|
||||
|
|
|
@ -1271,6 +1271,7 @@ namespace ts {
|
|||
setNodeEmitFlags(block, NodeEmitFlags.SingleLine);
|
||||
}
|
||||
|
||||
setOriginalNode(block, node.body);
|
||||
return block;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,9 +110,7 @@ var f8 = function (x, y, z) {
|
|||
var f9 = function (a) { return a; };
|
||||
var f10 = function (a) { return a; };
|
||||
var f11 = function (a) { return a; };
|
||||
var f12 = function (a) {
|
||||
return a;
|
||||
};
|
||||
var f12 = function (a) { return a; };
|
||||
// Should be valid.
|
||||
var f11 = function (a) { return a; };
|
||||
// Should be valid.
|
||||
|
|
Loading…
Reference in a new issue