Skip to content

Commit 539300b

Browse files
Merge pull request microsoft#1496 from Microsoft/bindingContainers
Simplify how we set container.nextContainer now that we don't double recurse during binding.
2 parents 9bb6cee + cb8d2f2 commit 539300b

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/compiler/binder.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,23 +227,27 @@ module ts {
227227
if (symbolKind & SymbolFlags.HasLocals) {
228228
node.locals = {};
229229
}
230+
230231
var saveParent = parent;
231232
var saveContainer = container;
232233
var savedBlockScopeContainer = blockScopeContainer;
233234
parent = node;
234235
if (symbolKind & SymbolFlags.IsContainer) {
235236
container = node;
236-
// If container is not on container list, add it to the list
237-
if (lastContainer !== container && !container.nextContainer) {
238-
if (lastContainer) {
239-
lastContainer.nextContainer = container;
240-
}
241-
lastContainer = container;
237+
Debug.assert(container.nextContainer === undefined);
238+
239+
if (lastContainer) {
240+
Debug.assert(lastContainer.nextContainer === undefined);
241+
lastContainer.nextContainer = container;
242242
}
243+
244+
lastContainer = container;
243245
}
246+
244247
if (isBlockScopeContainer) {
245248
blockScopeContainer = node;
246249
}
250+
247251
forEachChild(node, bind);
248252
container = saveContainer;
249253
parent = saveParent;

0 commit comments

Comments
 (0)