public static TLFunction ToTLFunction(FunctionDeclaration decl, ModuleContents contents, TypeMapper typeMap) { string nameToSearch = GetNameToSearchOn(decl); var funcs = FuncsToSearch(contents, decl, nameToSearch); return(MatchFunctionDecl(decl, funcs, typeMap)); }
static List <TLFunction> FuncsToSearch(ModuleContents contents, FunctionDeclaration decl, string name) { List <TLFunction> funcs = null; if (decl.Parent == null) // top level { if (decl.IsProperty) { funcs = contents.Functions.MethodsWithName(name).Where(tlf => tlf.Signature is SwiftPropertyType).ToList(); } else { funcs = contents.Functions.MethodsWithName(name).Where(tlf => !(tlf.Signature is SwiftPropertyType)).ToList(); } } else { var cn = ToSwiftClassName(decl); var theClass = LocateClassContents(contents, cn); funcs = FuncsToSearch(theClass, decl, name); } return(funcs); }
public static ProtocolContents LocateProtocolContents(ModuleContents contents, SwiftClassName cn) { return(contents.Protocols.Values.FirstOrDefault(cc => cc.Name.Equals(cn))); }
public static TLFunction ToProtocolFactory(string swiftProxyFactoryName, ModuleDeclaration modDecl, ModuleContents contents, TypeMapper typeMap) { var swiftProxyFunctionDecl = modDecl.TopLevelFunctions.Where(fn => fn.Name == swiftProxyFactoryName).FirstOrDefault(); if (swiftProxyFunctionDecl == null) { return(null); } return(ToTLFunction(swiftProxyFunctionDecl, contents, typeMap)); }