From a50ab3ebb00d381974ad0308aaff2c4c9091be4c Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 2 Jun 2015 12:20:36 -0700 Subject: [PATCH] Remove checking in declareSymbol --- src/compiler/binder.ts | 20 ++++++++++---------- src/compiler/types.ts | 3 +-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index b417892d354..60b5a622ac6 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -135,14 +135,14 @@ module ts { return node.name ? declarationNameToString(node.name) : getDeclarationName(node); } - /** - * Checks if the symbol contains a class declaration that is non-ambient. - */ - function hasNonAmbientClass(symbol: Symbol): boolean { - return symbol && forEach(symbol.declarations, (element: Declaration) => { - return element.kind === SyntaxKind.ClassDeclaration && !(element.flags & NodeFlags.Ambient); - }); - } + // /** + // * Checks if the symbol contains a class declaration that is non-ambient. + // */ + // function hasNonAmbientClass(symbol: Symbol): boolean { + // return symbol && forEach(symbol.declarations, (element: Declaration) => { + // return element.kind === SyntaxKind.ClassDeclaration && !(element.flags & NodeFlags.Ambient); + // }); + // } /** * Declares a Symbol for the Node and add it to symbols. Reports errors for conflicting identifier names. @@ -164,7 +164,7 @@ module ts { // Check for declarations 'node' cannot be merged with. // Interfaces declarations cannot be merged with non-ambient class declarations, which isn't encoded in SymbolFlags. - if (symbol.flags & excludes || (node.kind === SyntaxKind.InterfaceDeclaration && hasNonAmbientClass(symbol))) { + if (symbol.flags & excludes) { if (node.name) { node.name.parent = node; } @@ -536,7 +536,7 @@ module ts { bindCatchVariableDeclaration(node); break; case SyntaxKind.ClassDeclaration: - bindBlockScopedDeclaration(node, SymbolFlags.Class, isAmbientContext(node) ? SymbolFlags.AmbientClassExcludes : SymbolFlags.ClassExcludes); + bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes); break; case SyntaxKind.InterfaceDeclaration: bindBlockScopedDeclaration(node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 890c6968de9..ec5a8de0051 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1472,8 +1472,7 @@ module ts { PropertyExcludes = Value, EnumMemberExcludes = Value, FunctionExcludes = Value & ~(Function | ValueModule), - ClassExcludes = (Value | Type) & ~ValueModule, - AmbientClassExcludes = (Value | Type) & ~(ValueModule | Interface), + ClassExcludes = (Value | Type) & ~(ValueModule | Interface), // class-interface mergability done in checker.ts InterfaceExcludes = Type & ~(Interface | Class), RegularEnumExcludes = (Value | Type) & ~(RegularEnum | ValueModule), // regular enums merge only with regular enums and modules ConstEnumExcludes = (Value | Type) & ~ConstEnum, // const enums merge only with const enums