mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Emit arrow functions with expression bodies 'as is' when targetting ES6 or higher.
This commit is contained in:
@@ -3883,6 +3883,17 @@ module ts {
|
||||
}
|
||||
|
||||
function emitExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
emitDownLevelExpressionFunctionBody(node, body);
|
||||
return;
|
||||
}
|
||||
|
||||
// For es6 and higher we can emit the expression as is.
|
||||
write(" ");
|
||||
emit(body);
|
||||
}
|
||||
|
||||
function emitDownLevelExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) {
|
||||
write(" {");
|
||||
scopeEmitStart(node);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user