From e5e8c6b0b936d07365bfcc07b7363380998da163 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 13 Apr 2016 16:14:29 -0700 Subject: [PATCH] Add explanatory comment when adding ContainsLexicalThisInComputedPropertyName --- src/compiler/binder.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index b48b320d0d1..5ed1e9665d5 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1911,6 +1911,9 @@ namespace ts { // Instead, we mark the container as ES6, so that it can properly handle the transform. transformFlags = TransformFlags.ContainsComputedPropertyName; if (subtreeFlags & TransformFlags.ContainsLexicalThis) { + // A computed method name that contains `this` needs to + // distinguish itself from the normal case of a method body containing `this`. + // So convert ContainsLexicalThis to ContainsLexicalThisInComputedPropertyName transformFlags |= TransformFlags.ContainsLexicalThisInComputedPropertyName; } break;