protected static bool HidesMember(BaseRefactoringContext ctx, AstNode node, string variableName, out IMember member) { MemberCollectionService mcs = (MemberCollectionService)ctx.GetService(typeof(MemberCollectionService)); if (mcs == null) { lock (ctx) { if ((mcs = (MemberCollectionService)ctx.GetService(typeof(MemberCollectionService))) == null) { mcs = new MemberCollectionService(); ctx.Services.AddService(typeof(MemberCollectionService), mcs); } } } var typeDecl = node.GetParent <TypeDeclaration>(); member = null; if (typeDecl == null) { return(false); } var entityDecl = node.GetParent <EntityDeclaration>(); var memberResolveResult = ctx.Resolve(entityDecl) as MemberResolveResult; if (memberResolveResult == null) { return(false); } var typeResolveResult = ctx.Resolve(typeDecl) as TypeResolveResult; if (typeResolveResult == null) { return(false); } var sourceMember = memberResolveResult.Member; member = mcs.GetMembers(typeResolveResult.Type, variableName).FirstOrDefault(m2 => IsAccessible(sourceMember, m2)); return(member != null); }
public GatherVisitor(BaseRefactoringContext ctx) : base(ctx) { service = (NamingConventionService)ctx.GetService(typeof(NamingConventionService)); }