private static ResolvedType[] GetFrameworkConstructorSignature(string typeName) { if (frameworkConstructors == null) { string[] prefixes = new string[] { "", "System.Collections.Generic." }; frameworkConstructors = new Dictionary <string, ResolvedType[]>(); foreach (string line in Util.GetTextResource("TypeMetadata/FrameworkConstructors.txt").Split('\n')) { string tLine = line.Trim(); if (tLine.Length > 0) { if (!tLine.EndsWith(')')) { throw new System.Exception(line); } tLine = tLine.Substring(0, tLine.Length - 1); string[] parts = tLine.Split('('); if (parts.Length != 2) { throw new System.Exception(line); } parts[1] = parts[1].Trim(); string className = parts[0]; ResolvedType classType = ResolvedType.CreateFrameworkType(className); List <CSharpType> argTypes = new List <CSharpType>(); TokenStream tokenStream = new TokenStream("metadata", parts[1], new Dictionary <string, bool>()); while (tokenStream.HasMore) { if (argTypes.Count > 0) { tokenStream.PopExpected(","); } argTypes.Add(CSharpType.Parse(tokenStream)); } ResolvedType[] argResolvedTypes = argTypes .Select(argType => ResolvedType.Create(argType, prefixes, null)) .ToArray(); ResolvedType ctorType = ResolvedType.CreateFunction(classType, argResolvedTypes); if (!frameworkConstructors.ContainsKey(className)) { frameworkConstructors[className] = new ResolvedType[] { ctorType }; } else { List <ResolvedType> ctorTypes = new List <ResolvedType>(frameworkConstructors[className]); ctorTypes.Add(ctorType); frameworkConstructors[className] = ctorTypes.ToArray(); } } } } ResolvedType[] output; return(frameworkConstructors.TryGetValue(typeName, out output) ? output : null); }
internal ResolvedType DoTypeLookupFailSilently(CSharpType type, ParserContext context) { return(ResolvedType.Create(type, this.GetAllNamespaceSearchPrefixes(), context)); }