diff --git a/src/compiler/printer.ts b/src/compiler/printer.ts index 89d7ef04140..62b73924da9 100644 --- a/src/compiler/printer.ts +++ b/src/compiler/printer.ts @@ -1546,7 +1546,7 @@ const _super = (function (geti, seti) { const savedTempFlags = tempFlags; tempFlags = 0; emitSignatureHead(node); - emitBlockFunctionBodyAndEndLexicalEnvironment(node, body); + emitBlockFunctionBody(node, body); if (indentedFlag) { decreaseIndent(); } @@ -1610,7 +1610,7 @@ const _super = (function (geti, seti) { return true; } - function emitBlockFunctionBodyAndEndLexicalEnvironment(parentNode: Node, body: Block) { + function emitBlockFunctionBody(parentNode: Node, body: Block) { // TODO(rbuckton): This should be removed once source maps are aligned with the old // emitter and new baselines are taken. This exists solely to // align with the old emitter. diff --git a/src/compiler/transformers/es6.ts b/src/compiler/transformers/es6.ts index fe48fed049a..ceff4d0db50 100644 --- a/src/compiler/transformers/es6.ts +++ b/src/compiler/transformers/es6.ts @@ -1063,7 +1063,8 @@ namespace ts { "_this", createThis() ) - ]) + ]), + /*location*/ node ) ); } @@ -1343,7 +1344,9 @@ namespace ts { const expression = visitNode(body, visitor, isExpression); if (expression) { - statements.push(createReturn(expression, /*location*/ statementsLocation)); + const returnStatement = createReturn(expression, /*location*/ statementsLocation); + setNodeEmitFlags(returnStatement, NodeEmitFlags.NoTokenSourceMaps); + statements.push(returnStatement); } }