Skip to content

Commit 719705f

Browse files
committed
Adds source maps for captured this, skips source map for synthetic return token in arrow.
1 parent 6b1f852 commit 719705f

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/compiler/printer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ const _super = (function (geti, seti) {
15461546
const savedTempFlags = tempFlags;
15471547
tempFlags = 0;
15481548
emitSignatureHead(node);
1549-
emitBlockFunctionBodyAndEndLexicalEnvironment(node, body);
1549+
emitBlockFunctionBody(node, body);
15501550
if (indentedFlag) {
15511551
decreaseIndent();
15521552
}
@@ -1610,7 +1610,7 @@ const _super = (function (geti, seti) {
16101610
return true;
16111611
}
16121612

1613-
function emitBlockFunctionBodyAndEndLexicalEnvironment(parentNode: Node, body: Block) {
1613+
function emitBlockFunctionBody(parentNode: Node, body: Block) {
16141614
// TODO(rbuckton): This should be removed once source maps are aligned with the old
16151615
// emitter and new baselines are taken. This exists solely to
16161616
// align with the old emitter.

src/compiler/transformers/es6.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,8 @@ namespace ts {
10631063
"_this",
10641064
createThis()
10651065
)
1066-
])
1066+
]),
1067+
/*location*/ node
10671068
)
10681069
);
10691070
}
@@ -1343,7 +1344,9 @@ namespace ts {
13431344

13441345
const expression = visitNode(body, visitor, isExpression);
13451346
if (expression) {
1346-
statements.push(createReturn(expression, /*location*/ statementsLocation));
1347+
const returnStatement = createReturn(expression, /*location*/ statementsLocation);
1348+
setNodeEmitFlags(returnStatement, NodeEmitFlags.NoTokenSourceMaps);
1349+
statements.push(returnStatement);
13471350
}
13481351
}
13491352

0 commit comments

Comments
 (0)