Emit arrow functions with expression bodies 'as is' when targetting ES6 or higher.

This commit is contained in:
Cyrus Najmabadi
2015-02-21 17:16:04 -08:00
parent 11944be1b4
commit 91eedcddef
12 changed files with 44 additions and 33 deletions

View File

@@ -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);