Removes most parent node references from the emitter

This commit is contained in:
Ron Buckton
2015-07-17 17:00:43 -07:00
parent a78421fea0
commit a484bb7f46
2 changed files with 315 additions and 217 deletions
+287 -217
View File
File diff suppressed because it is too large Load Diff
+28
View File
@@ -367,6 +367,30 @@ namespace ts {
return flags;
}
export function getCombinedNodeFlagsForNodeStack(nodeStack: Node[]): NodeFlags {
let i = nodeStack.length - 1;
let node = nodeStack[i--];
while (node && (node.kind === SyntaxKind.BindingElement || isBindingPattern(node))) {
node = nodeStack[i--];
}
let flags = node.flags;
if (node && node.kind === SyntaxKind.VariableDeclaration) {
node = nodeStack[i--];
}
if (node && node.kind === SyntaxKind.VariableDeclarationList) {
flags |= node.flags;
node = nodeStack[i--];
}
if (node && node.kind === SyntaxKind.VariableStatement) {
flags |= node.flags;
}
return flags;
}
export function isConst(node: Node): boolean {
return !!(getCombinedNodeFlags(node) & NodeFlags.Const);
@@ -1178,6 +1202,10 @@ namespace ts {
return false;
}
}
export function isModuleDeclaration(node: Node): node is ModuleDeclaration {
return node && node.kind === SyntaxKind.ModuleDeclaration;
}
// True if the given identifier, string literal, or number literal is the name of a declaration node
export function isDeclarationName(name: Node): boolean {