protected override IEnumerable <object> GetValidMembers() { var type = Options.EnclosingType; if (type == null || Options.EnclosingMember != null) { yield break; } foreach (var t in type.DirectBaseTypes) { string name; if (!HasProtocolAttribute(t, out name)) { continue; } var protocolType = Options.Document.Compilation.FindType(new FullTypeName(new TopLevelTypeName(t.Namespace, name))); if (protocolType == null) { break; } foreach (var member in protocolType.GetMethods(null, GetMemberOptions.IgnoreInheritedMembers)) { if (member.ImplementedInterfaceMembers.Any()) { continue; } if (!cg.IsValidMember(member)) { continue; } if (IsImplemented(type, member)) { continue; } if (member.Attributes.Any(a => a.AttributeType.Name == "ExportAttribute" && MonoCSharpCompletionEngine.IsFoundationNamespace(a.AttributeType.Namespace))) { yield return(member); } } foreach (var member in protocolType.GetProperties(null, GetMemberOptions.IgnoreInheritedMembers)) { if (member.ImplementedInterfaceMembers.Any()) { continue; } if (!cg.IsValidMember(member)) { continue; } if (IsImplemented(type, member)) { continue; } if (member.CanGet && member.Getter.Attributes.Any(a => a.AttributeType.Name == "ExportAttribute" && MonoCSharpCompletionEngine.IsFoundationNamespace(a.AttributeType.Namespace)) || member.CanSet && member.Setter.Attributes.Any(a => a.AttributeType.Name == "ExportAttribute" && MonoCSharpCompletionEngine.IsFoundationNamespace(a.AttributeType.Namespace))) { yield return(member); } } } }
protected override IEnumerable <object> GetValidMembers() { var type = Options.EnclosingType; if (type == null || Options.EnclosingMember != null) { yield break; } foreach (var t in type.GetBaseTypes()) { string name; if (!ProtocolMemberContextHandler.HasProtocolAttribute(t, out name)) { continue; } var protocolType = Options.CurrentState.Compilation.GetTypeByMetadataName(t.ContainingNamespace.GetFullName() + "." + name); if (protocolType == null) { break; } foreach (var member in protocolType.GetMembers().OfType <IMethodSymbol>()) { if (member.ExplicitInterfaceImplementations.Length > 0) { continue; } if (!cg.IsValidMember(member)) { continue; } if (IsImplemented(type, member)) { continue; } if (member.GetAttributes().Any(a => a.AttributeClass.Name == "ExportAttribute" && ProtocolMemberContextHandler.IsFoundationNamespace(a.AttributeClass.ContainingNamespace))) { yield return(member); } } foreach (var member in protocolType.GetMembers().OfType <IPropertySymbol>()) { if (member.ExplicitInterfaceImplementations.Length > 0) { continue; } if (!cg.IsValidMember(member)) { continue; } if (IsImplemented(type, member)) { continue; } if (member.GetMethod != null && member.GetMethod.GetAttributes().Any(a => a.AttributeClass.Name == "ExportAttribute" && ProtocolMemberContextHandler.IsFoundationNamespace(a.AttributeClass.ContainingNamespace)) || member.SetMethod != null && member.SetMethod.GetAttributes().Any(a => a.AttributeClass.Name == "ExportAttribute" && ProtocolMemberContextHandler.IsFoundationNamespace(a.AttributeClass.ContainingNamespace))) { yield return(member); } } } }