private bool ReferencePointsToExcludedType( DescriptionModel.TypeReference typeReference, string contextNamespace) { if (typeReference.Named != null) { var fullName = $"{contextNamespace}.{typeReference.Named.Name}"; return(this.settings.OtherExcludedTypes.Contains(fullName) || this.settings.ExcludedAstNodes.Contains(fullName)); } return(false); }
private HashSet <Declaration> BreakdownInheritanceList(string contextNamespace, DescriptionModel.TypeReference typeReference, AstDescription astDescription) { HashSet <Declaration> result = new HashSet <Declaration>(); if (this.ReferencePointsToExcludedType(typeReference, contextNamespace)) { return(result); } if (typeReference.Named != null) { var declaration = astDescription.GetReferredDeclaration(typeReference.Named.Name, contextNamespace); if (declaration == null) { throw new InvalidOperationException($"Unknown inhertiance reference {typeReference.Named.Name}"); } if (declaration.NamedDeclaration is DescriptionModel.InterfaceDescription) { result.Add(declaration); return(result); } if (declaration.NamedDeclaration is DescriptionModel.TypeAliasDescription typeAlias) { if (typeAlias.Type.Union != null) { foreach (var u in typeAlias.Type.Union.Types) { foreach (var item in this.BreakdownInheritanceList(contextNamespace, u, astDescription)) { result.Add(item); } } return(result); } } } throw new InvalidOperationException("Unable breakdown inheritance list."); }