示例#1
0
        static GacMethod PickFunction(GacUDT udt, string methodLocalName, string methodParameters)
        {
            if (methodLocalName == "#ctor")
            {
                CppName cppName = CppName.Parse(udt.Name);
                methodLocalName = cppName.Cascade().Last().Name;
            }
            var m1 = TryPickFunction(udt, udt.Methods, methodLocalName, methodParameters);
            var m2 = TryPickFunction(udt, udt.StaticMethods, methodLocalName, methodParameters);

            if ((m1 == null) ^ (m2 == null) != true)
            {
                throw new ArgumentException();
            }
            return(m1 ?? m2);
        }
示例#2
0
        public DocType GetType(GacUDT udt, Dictionary <string, GacUDT> udts)
        {
            DocType resultType = null;

            if (!this.typeCache.TryGetValue(udt, out resultType))
            {
                CppName cppName      = CppName.Parse(udt.Name);
                var     cascadeNames = cppName
                                       .Cascade()
                                       .Select(c => new CppName()
                {
                    Name       = c.Name,
                    Parameters = c.Parameters,
                }.ToPdbString())
                                       .ToArray();

                string currentName    = "";
                int    namespaceCount = 0;
                for (int i = 0; i < cascadeNames.Length; i++)
                {
                    currentName += (i == 0 ? "" : "::") + cascadeNames[i];
                    if (udts.ContainsKey(currentName))
                    {
                        break;
                    }
                    namespaceCount = i + 1;
                }

                DocItemContainer ic = GetNamespace(cascadeNames.Take(namespaceCount));
                for (int i = namespaceCount; i < cascadeNames.Length; i++)
                {
                    ic = ic.GetType(cascadeNames[i]);
                }
                resultType     = (DocType)ic;
                resultType.Udt = udt;
                this.typeCache.Add(udt, resultType);
            }
            return(resultType);
        }