From 416267172d832bd224a6b6d74842c60fbbddd89e Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 30 Jan 2015 17:48:07 -0800 Subject: [PATCH] Address code review --- src/compiler/checker.ts | 2 +- src/compiler/emitter.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 29c22064787..072c7cd9ebb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4915,7 +4915,7 @@ module ts { container = getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code - needToCaptureLexicalThis = !(compilerOptions.target >= ScriptTarget.ES6); + needToCaptureLexicalThis = (languageVersion < ScriptTarget.ES6); } switch (container.kind) { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e889ecc8868..c33f7fd5234 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1487,7 +1487,6 @@ module ts { // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compilerOnSave feature export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile?: SourceFile): EmitResult { - // var program = resolver.getProgram(); var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || ScriptTarget.ES3; var sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined; @@ -3241,7 +3240,7 @@ module ts { } function shouldEmitAsArrowFunction(node: FunctionLikeDeclaration): boolean { - return node.kind === SyntaxKind.ArrowFunction && compilerOptions.target >= ScriptTarget.ES6; + return node.kind === SyntaxKind.ArrowFunction && languageVersion >= ScriptTarget.ES6; } function emitFunctionDeclaration(node: FunctionLikeDeclaration) {