diff options
author | David Karlaš <david.karlas@xamarin.com> | 2015-09-14 19:18:59 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2015-09-14 19:18:59 +0300 |
commit | 6c5fd21f3c99a01b37ce00a3e7981b268621eb8b (patch) | |
tree | c797bb698ce762bc0faccc90f0e5e2a793298edb | |
parent | 39093e9a8a9a55c64cb16363e46fef895e7e3637 (diff) |
Bug 33935 - Unknown identifier when debugging C#6
This is just re-sync with roslyn ExpressionSyntaxExtensions.cs file
-rw-r--r-- | main/src/addins/CSharpBinding/Util/ExpressionSyntaxExtensions.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/main/src/addins/CSharpBinding/Util/ExpressionSyntaxExtensions.cs b/main/src/addins/CSharpBinding/Util/ExpressionSyntaxExtensions.cs index fbc41e9d7d..e916ed1e00 100644 --- a/main/src/addins/CSharpBinding/Util/ExpressionSyntaxExtensions.cs +++ b/main/src/addins/CSharpBinding/Util/ExpressionSyntaxExtensions.cs @@ -121,12 +121,24 @@ namespace ICSharpCode.NRefactory6.CSharp public static bool IsMemberAccessExpressionName(this ExpressionSyntax expression) { return (expression.IsParentKind(SyntaxKind.SimpleMemberAccessExpression) && ((MemberAccessExpressionSyntax)expression.Parent).Name == expression) || - (expression.IsParentKind(SyntaxKind.MemberBindingExpression) && expression.Parent.Parent.IsParentKind(SyntaxKind.ConditionalAccessExpression) && ((MemberBindingExpressionSyntax)expression.Parent).Name == expression); + (IsMemberBindingExpressionName(expression)); } public static bool IsAnyMemberAccessExpressionName(this ExpressionSyntax expression) { - return expression != null && expression.Parent is MemberAccessExpressionSyntax && ((MemberAccessExpressionSyntax)expression.Parent).Name == expression; + if (expression == null) + { + return false; + } + + return expression == (expression.Parent as MemberAccessExpressionSyntax)?.Name || + expression.IsMemberBindingExpressionName(); + } + + private static bool IsMemberBindingExpressionName(this ExpressionSyntax expression) + { + return expression.IsParentKind(SyntaxKind.MemberBindingExpression) && + ((MemberBindingExpressionSyntax)expression.Parent).Name == expression; } public static bool IsRightSideOfQualifiedName(this ExpressionSyntax expression) |