public static void AddContentsFromCalling(List <ICompletionEntry> result, IClass callingClass, IMember callingMember) { IMethodOrProperty methodOrProperty = callingMember as IMethodOrProperty; if (methodOrProperty != null) { foreach (IParameter p in methodOrProperty.Parameters) { result.Add(new DefaultField.ParameterField(p.ReturnType, p.Name, methodOrProperty.Region, callingClass)); } if (callingMember is IMethod) { AddTypeParametersForCtrlSpace(result, ((IMethod)callingMember).TypeParameters); } } bool inStatic = false; if (callingMember != null) { inStatic = callingMember.IsStatic; } if (callingClass != null) { AddTypeParametersForCtrlSpace(result, callingClass.TypeParameters); List <ICompletionEntry> members = new List <ICompletionEntry>(); IReturnType t = callingClass.DefaultReturnType; var language = callingClass.ProjectContent.Language; foreach (IMember m in MemberLookupHelper.GetAccessibleMembers(t, callingClass, language, true)) { if ((!inStatic || m.IsStatic) && language.ShowMember(m, m.IsStatic)) { result.Add(m); } } members.Clear(); IClass c = callingClass.DeclaringType; while (c != null) { t = c.DefaultReturnType; foreach (IMember m in MemberLookupHelper.GetAccessibleMembers(t, c, language, true)) { if (language.ShowMember(m, true)) { result.Add(m); } } c = c.DeclaringType; } } }
public override List <ICompletionEntry> GetCompletionData(IProjectContent projectContent) { if (this.ResolvedType == null) { return(null); } List <ICompletionEntry> res = new List <ICompletionEntry>(); foreach (IMember m in MemberLookupHelper.GetAccessibleMembers(this.ResolvedType, this.CallingClass, projectContent.Language, true)) { if (projectContent.Language.ShowMember(m, false)) { res.Add(m); } } if (this.CallingClass != null) { AddExtensions(projectContent.Language, res.Add, this.CallingClass, this.ResolvedType); } return(res); }
protected List <ICompletionEntry> GetCompletionData(LanguageProperties language, bool showStatic) { if (resolvedType == null) { return(null); } List <ICompletionEntry> res = new List <ICompletionEntry>(); foreach (IMember m in MemberLookupHelper.GetAccessibleMembers(resolvedType, callingClass, language)) { if (language.ShowMember(m, showStatic)) { res.Add(m); } } if (!showStatic && callingClass != null) { AddExtensions(language, res.Add, callingClass, resolvedType, this.showAllNamespacesContentsInCC); } return(res); }
public static bool ImplementsAbstractClass(this IClass targetClass, IClass abstractClass) { var requiredAbstractMembers = MemberLookupHelper.GetAccessibleMembers(abstractClass.DefaultReturnType, targetClass, LanguageProperties.CSharp, true).Where(m => m.IsAbstract); return(!requiredAbstractMembers.Any(missingMember => !targetClass.HasMember(missingMember))); }