예제 #1
0
        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);
        }
예제 #2
0
        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());
        }
예제 #3
0
 public static bool Is(this LanguageFlags value, Language language) => value.Is(language.ToFlags());