Esempio n. 1
0
        public static string GetMethodName(ParseTreeNode node)
        {
            var dotCtorParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.dotCtor);

            if (dotCtorParseTreeNode != null)
            {
                return(".ctor");
            }

            var dotCctorParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.keyword_dotCctor);

            if (dotCctorParseTreeNode != null)
            {
                return(".cctor");
            }

            var name1ParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.name1);

            if (name1ParseTreeNode != null)
            {
                return(Name1ParseTreeNodeHelper.GetValue(name1ParseTreeNode));
            }

            throw new ArgumentException("Cannot get method name value.");
        }
Esempio n. 2
0
        public static CILClassName GetClassName(ParseTreeNode node)
        {
            var assemblyName       = string.Empty;
            var name1ParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.name1);

            if (name1ParseTreeNode != null)
            {
                assemblyName = Name1ParseTreeNodeHelper.GetValue(name1ParseTreeNode);
            }

            var slashedNameParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.slashedName);
            var className = SlashedNameParseTreeNodeHelper.GetValue(slashedNameParseTreeNode);

            return(new CILClassName
            {
                AssemblyName = assemblyName,
                ClassName = className
            });
        }
        public static string GetValue(ParseTreeNode node)
        {
            var name1ParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.name1);

            return(Name1ParseTreeNodeHelper.GetValue(name1ParseTreeNode));
        }