mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-21 08:25:43 -05:00
Address code review
This commit is contained in:
@@ -441,6 +441,9 @@ module ts {
|
||||
bindBlockScopedVariableDeclaration(<Declaration>node);
|
||||
}
|
||||
else if (isParameterDeclaration(<VariableLikeDeclaration>node)) {
|
||||
// It is safe to walk up parent chain to find whether the node is a destructing parameter declaration
|
||||
// because its parent chain has already been set up, since parents are set before descending into children.
|
||||
//
|
||||
// If node is a binding element in parameter declaration, we need to use ParameterExcludes.
|
||||
// Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration
|
||||
// For example:
|
||||
|
||||
@@ -2048,13 +2048,6 @@ module ts {
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
|
||||
function getRootDeclaration(node: Node): Node {
|
||||
while (node.kind === SyntaxKind.BindingElement) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function getDeclarationContainer(node: Node): Node {
|
||||
node = getRootDeclaration(node);
|
||||
|
||||
|
||||
@@ -1151,10 +1151,15 @@ module ts {
|
||||
}
|
||||
|
||||
export function isParameterDeclaration(node: VariableLikeDeclaration) {
|
||||
let root = getRootDeclaration(node);
|
||||
return root.kind === SyntaxKind.Parameter;
|
||||
}
|
||||
|
||||
export function getRootDeclaration(node: Node): Node {
|
||||
while (node.kind === SyntaxKind.BindingElement) {
|
||||
node = <VariableLikeDeclaration>node.parent.parent;
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node.kind === SyntaxKind.Parameter;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function nodeStartsNewLexicalEnvironment(n: Node): boolean {
|
||||
|
||||
Reference in New Issue
Block a user