bool HasConflictingNames(AstNode targetContext, AstNode currentContext)
            {
                var targetSpace  = declarationSpaceVisitor.GetDeclarationSpace(targetContext);
                var currentSpace = declarationSpaceVisitor.GetDeclarationSpace(currentContext);

                foreach (var name in currentSpace.DeclaredNames)
                {
                    var isUsed = targetSpace.GetNameDeclarations(name).Any(node => node.Ancestors.Any(n => n == currentContext));
                    if (isUsed)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            void AnalyzeThisReferenceExpression(ThisReferenceExpression thisReferenceExpression)
            {
                var memberReference = thisReferenceExpression.Parent as MemberReferenceExpression;

                if (memberReference == null)
                {
                    return;
                }

                var state       = ctx.GetResolverStateAfter(thisReferenceExpression);
                var wholeResult = ctx.Resolve(memberReference);

                IMember member = GetMember(wholeResult);

                if (member == null)
                {
                    return;
                }

                if (declarationsSpaceVisitor.GetDeclarationSpace(thisReferenceExpression).IsNameUsed(member.Name))
                {
                    return;
                }

                var result       = state.LookupSimpleNameOrTypeName(memberReference.MemberName, EmptyList <IType> .Instance, NameLookupMode.Expression);
                var parentResult = ctx.Resolve(memberReference.Parent) as CSharpInvocationResolveResult;

                bool isRedundant;

                if (result is MemberResolveResult)
                {
                    isRedundant = ((MemberResolveResult)result).Member.Region.Equals(member.Region);
                }
                else if (parentResult != null && parentResult.IsExtensionMethodInvocation)
                {
                    // 'this.' is required for extension method invocation
                    isRedundant = false;
                }
                else if (result is MethodGroupResolveResult)
                {
                    isRedundant = ((MethodGroupResolveResult)result).Methods.Any(m => m.Region.Equals(member.Region));
                }
                else
                {
                    return;
                }

                if (isRedundant)
                {
                    var issueDescription  = ctx.TranslateString("'this.' is redundant and can be removed safely.");
                    var actionDescription = ctx.TranslateString("Remove 'this.'");
                    AddIssue(new CodeIssue(thisReferenceExpression.StartLocation, memberReference.MemberNameToken.StartLocation, issueDescription, actionDescription, script => {
                        script.Replace(memberReference, RefactoringAstHelper.RemoveTarget(memberReference));
                    })
                    {
                        IssueMarker = IssueMarker.GrayOut
                    });
                }
            }
            void AnalyzeThisReferenceExpression(BaseReferenceExpression baseReferenceExpression)
            {
                var memberReference = baseReferenceExpression.Parent as MemberReferenceExpression;

                if (memberReference == null)
                {
                    return;
                }

                var state       = ctx.GetResolverStateAfter(baseReferenceExpression);
                var wholeResult = ctx.Resolve(memberReference);

                IMember member = GetMember(wholeResult);

                if (member == null)
                {
                    return;
                }

                var localDeclarationSpace = declarationsSpaceVisitor.GetDeclarationSpace(baseReferenceExpression);

                if (localDeclarationSpace == null || localDeclarationSpace.IsNameUsed(member.Name))
                {
                    return;
                }

                var result       = state.LookupSimpleNameOrTypeName(memberReference.MemberName, EmptyList <IType> .Instance, NameLookupMode.Expression);
                var parentResult = ctx.Resolve(memberReference.Parent) as CSharpInvocationResolveResult;

                bool isRedundant;

                if (result is MemberResolveResult)
                {
                    isRedundant = ((MemberResolveResult)result).Member.Region.Equals(member.Region);
                }
                else if (parentResult != null && parentResult.IsExtensionMethodInvocation)
                {
                    // 'this.' is required for extension method invocation
                    isRedundant = false;
                }
                else if (result is MethodGroupResolveResult)
                {
                    isRedundant = ((MethodGroupResolveResult)result).Methods.Any(m => m.Region.Equals(member.Region));
                }
                else
                {
                    return;
                }

                var basicMembers    = state.CurrentTypeDefinition.DirectBaseTypes.First().GetMembers();
                var extendedMembers = state.CurrentTypeDefinition.GetMembers().Except(basicMembers);

                if (extendedMembers.Any(f => f.Name.Equals(member.Name)))
                {
                    return;
                }

                if (isRedundant)
                {
                    AddIssue(new CodeIssue(
                                 baseReferenceExpression.StartLocation,
                                 memberReference.MemberNameToken.StartLocation,
                                 ctx.TranslateString("'base.' is redundant and can be removed safely."),
                                 ctx.TranslateString("Remove 'base.'"),
                                 script => {
                        script.Replace(memberReference, RefactoringAstHelper.RemoveTarget(memberReference));
                    }
                                 )
                    {
                        IssueMarker = IssueMarker.GrayOut
                    });
                }
            }