From ba239c5812aff528db3b080270a2bd4ad6bb12fe Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 15 Jan 2015 17:12:44 -0800 Subject: [PATCH] Address code review --- src/compiler/emitter.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 2e8502c8859..9670b62af1b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3211,10 +3211,7 @@ module ts { } function isES6ArrowFunction(node: FunctionLikeDeclaration): boolean { - if (node.kind === SyntaxKind.ArrowFunction && compilerOptions.target >= ScriptTarget.ES6) { - return true; - } - return false; + return node.kind === SyntaxKind.ArrowFunction && compilerOptions.target >= ScriptTarget.ES6; } function emitFunctionDeclaration(node: FunctionLikeDeclaration) { @@ -3289,11 +3286,7 @@ module ts { } var outPos = writer.getTextPos(); - // In ES6, fat arrow function lexically binds this value. Therefore, when targeting es6, we can omit capturing of "this" in the fat arrow function - if (!isES6ArrowFunction(node)) { - emitCaptureThisForNodeIfNecessary(node); - } - + emitCaptureThisForNodeIfNecessary(node); emitDefaultValueAssignments(node); emitRestParameter(node); if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {