From e6ea85d31b2a40ca2531791eb33dcde9d4b4e4f4 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 1 Aug 2014 12:36:09 -0700 Subject: [PATCH] Properly build container list in binder. Containers are added to container list only if they aren't already on the list. Fixes #325. --- src/compiler/binder.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index faf8d96e2be..7b16c785833 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -171,8 +171,13 @@ module ts { parent = node; if (symbolKind & SymbolFlags.IsContainer) { container = node; - if (lastContainer) lastContainer.nextContainer = container; - lastContainer = container; + // If container is not on container list, add it to the list + if (lastContainer !== container && !container.nextContainer) { + if (lastContainer) { + lastContainer.nextContainer = container; + } + lastContainer = container; + } } forEachChild(node, bind); container = saveContainer;