This commit is contained in:
Andy Hanson
2016-08-02 10:47:06 -07:00
parent 91c9d76f09
commit db44a71005

View File

@@ -980,21 +980,23 @@ namespace ts {
* but returns undefined if that expression is not an EntityNameExpression.
*/
function climbToEntityNameOfExpressionWithTypeArguments(node: Node): EntityNameExpression | undefined {
switch (node.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.PropertyAccessExpression:
if (node.parent) {
node = node.parent;
}
else {
for (; ; ) {
switch (node.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.PropertyAccessExpression:
if (node.parent) {
node = node.parent;
}
else {
return undefined;
}
break;
case SyntaxKind.ExpressionWithTypeArguments:
Debug.assert(isEntityNameExpression((<ExpressionWithTypeArguments>node).expression));
return <EntityNameExpression>(<ExpressionWithTypeArguments>node).expression;
default:
return undefined;
}
break;
case SyntaxKind.ExpressionWithTypeArguments:
Debug.assert(isEntityNameExpression((<ExpressionWithTypeArguments>node).expression));
return <EntityNameExpression>(<ExpressionWithTypeArguments>node).expression;
default:
return undefined;
}
}
}