public static UstNode RemoveNotIncludedNodes(this UstNode root, Language mainLanguage, LanguageFlags dependentLanguages) { UstNode result; if (dependentLanguages.Is(mainLanguage)) { result = root; } else { var includedChildren = root.GetAllDescendants(node => node.NodeType == NodeType.NamespaceDeclaration && dependentLanguages.Is(((NamespaceDeclaration)node).Language) && dependentLanguages.ToString().Contains(((NamespaceDeclaration)node).Name.Text)); result = CreateRootNamespace(includedChildren, mainLanguage, root.FileNode); } return(result); }
public static Language[] GetLanguages(this LanguageFlags value) { var result = new List <Language>(); foreach (Language language in Languages) { if (value.Is(language)) { result.Add(language); } } return(result.ToArray()); }
public static bool Is(this LanguageFlags value, Language language) => value.Is(language.ToFlags());