Пример #1
0
 public static ExpressionSyntax GetLeftSideOfDot(this SimpleNameSyntax name)
 {
     Debug.Assert(
         name.IsSimpleMemberAccessExpressionName() ||
         name.IsMemberBindingExpressionName() ||
         name.IsRightSideOfQualifiedName() ||
         name.IsParentKind(SyntaxKind.NameMemberCref)
         );
     if (name.IsSimpleMemberAccessExpressionName())
     {
         return(((MemberAccessExpressionSyntax)name.Parent).Expression);
     }
     else if (name.IsMemberBindingExpressionName())
     {
         return(name.GetParentConditionalAccessExpression().Expression);
     }
     else if (name.IsRightSideOfQualifiedName())
     {
         return(((QualifiedNameSyntax)name.Parent).Left);
     }
     else
     {
         return(((QualifiedCrefSyntax)name.Parent.Parent).Container);
     }
 }