From 720820487744f302c5831afb5cd9c86c784a5dbf Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 30 Nov 2017 12:33:34 -0800 Subject: [PATCH] Don't mutate symbol flags after creation --- src/compiler/binder.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 8145246adbb..71b5e1afbff 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2425,13 +2425,13 @@ namespace ts { if (!isPrototypeProperty && (!targetSymbol || !(targetSymbol.flags & SymbolFlags.Namespace)) && isLegalPosition) { Debug.assert(isIdentifier(propertyAccess.expression)); const identifier = propertyAccess.expression as Identifier; + const flags = SymbolFlags.Module | SymbolFlags.JSContainer; + const excludeFlags = SymbolFlags.ValueModuleExcludes & ~SymbolFlags.JSContainer; if (targetSymbol) { - addDeclarationToSymbol(symbol, identifier, SymbolFlags.Module); - symbol.flags |= SymbolFlags.JSContainer; + addDeclarationToSymbol(symbol, identifier, flags); } else { - targetSymbol = declareSymbol(container.locals, /*parent*/ undefined, identifier, SymbolFlags.Module, SymbolFlags.ValueModuleExcludes); - targetSymbol.flags |= SymbolFlags.JSContainer; + targetSymbol = declareSymbol(container.locals, /*parent*/ undefined, identifier, flags, excludeFlags); } } if (!targetSymbol || !(targetSymbol.flags & (SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.NamespaceModule))) {