提交 e9a22f1b 编写于 作者: Š Šimon Koníček

Removing unnecessary usage of GetAncestor

上级 c19fca10
......@@ -1010,7 +1010,7 @@ public static bool IsDefaultExpressionContext(this SyntaxTree syntaxTree, int po
if (token.IsKind(SyntaxKind.CommaToken) &&
token.Parent.IsDelegateOrConstructorOrLocalFunctionOrMethodOrOperatorParameterList(includeOperators))
{
var parameterList = token.GetAncestor<ParameterListSyntax>();
var parameterList = (ParameterListSyntax)token.Parent;
var commaIndex = parameterList.Parameters.GetWithSeparators().IndexOf(token);
parameterIndex = commaIndex / 2 + 1;
......@@ -1022,8 +1022,8 @@ public static bool IsDefaultExpressionContext(this SyntaxTree syntaxTree, int po
token.Parent.IsParentKind(SyntaxKind.Parameter) &&
token.Parent.Parent.Parent.IsDelegateOrConstructorOrLocalFunctionOrMethodOrOperatorParameterList(includeOperators))
{
var parameter = token.GetAncestor<ParameterSyntax>();
var parameterList = parameter.GetAncestorOrThis<ParameterListSyntax>();
var parameter = (ParameterSyntax)token.Parent.Parent;
var parameterList = (ParameterListSyntax)parameter.Parent;
parameterIndex = parameterList.Parameters.IndexOf(parameter);
return true;
......@@ -1034,8 +1034,8 @@ public static bool IsDefaultExpressionContext(this SyntaxTree syntaxTree, int po
token.Parent.IsKind(SyntaxKind.Parameter) &&
token.Parent.Parent.IsDelegateOrConstructorOrLocalFunctionOrMethodOrOperatorParameterList(includeOperators))
{
var parameter = token.GetAncestor<ParameterSyntax>();
var parameterList = parameter.GetAncestorOrThis<ParameterListSyntax>();
var parameter = (ParameterSyntax)token.Parent;
var parameterList = (ParameterListSyntax)parameter.Parent;
parameterIndex = parameterList.Parameters.IndexOf(parameter);
previousModifier = token.Kind();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册