From 744f640f42cd8fc1411cf8556bcdf5e3d9b4c862 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 1 Jul 2015 13:16:29 -0700 Subject: [PATCH] Add comment to clarify why we don't use copySymbol --- src/compiler/checker.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8df1f8bf808..e1f99882079 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12680,6 +12680,10 @@ namespace ts { break; case SyntaxKind.FunctionExpression: case SyntaxKind.ClassExpression: + // The reason we are not using copySymbol for function expression and class expression + // is that copySymbol will not copy a symbol into SymbolTable if the symbol has name prefix + // with "__". Therefore, if class expression or function expression have declared name, + // we will add the symbol into the table using its declared name let name = (location).name; if (name) { let symbol = location.symbol;