Inline binder method.

This commit is contained in:
Cyrus Najmabadi
2015-04-19 17:14:31 -07:00
parent 4455995477
commit 221262314c

View File

@@ -68,8 +68,7 @@ module ts {
if (!file.locals) {
file.locals = {};
container = file;
setBlockScopeContainer(file, /*cleanLocals*/ false);
container = blockScopeContainer = file;
bind(file);
file.symbolCount = symbolCount;
}
@@ -79,13 +78,6 @@ module ts {
return new Symbol(flags, name);
}
function setBlockScopeContainer(node: Node, cleanLocals: boolean) {
blockScopeContainer = node;
if (cleanLocals) {
blockScopeContainer.locals = undefined;
}
}
function addDeclarationToSymbol(symbol: Symbol, node: Declaration, symbolFlags: SymbolFlags) {
symbol.flags |= symbolFlags;
@@ -266,7 +258,10 @@ module ts {
// these cases are:
// - node has locals (symbolKind & HasLocals) !== 0
// - node is a source file
setBlockScopeContainer(node, /*cleanLocals*/ (symbolFlags & SymbolFlags.HasLocals) === 0 && node.kind !== SyntaxKind.SourceFile);
blockScopeContainer = node;
if ((symbolFlags & SymbolFlags.HasLocals) === 0 && node.kind !== SyntaxKind.SourceFile) {
blockScopeContainer.locals = undefined;
}
}
forEachChild(node, bind);