public List <NetParam> MapParameterList(BaseDeclaration context, List <ParameterItem> st, bool isPinvoke, bool structsAndEnumsAreAlwaysRefs, CSGenericTypeDeclarationCollection extraProtocolTypes, CSGenericConstraintCollection extraProtocolContstraints) { var parms = new List <NetParam> (); for (int i = 0; i < st.Count; i++) { if (st[i].TypeSpec is ProtocolListTypeSpec plitem && !isPinvoke) { var genprotoName = new CSIdentifier($"TProto{i}"); extraProtocolTypes.Add(new CSGenericTypeDeclaration(genprotoName)); extraProtocolContstraints.Add(new CSGenericConstraint(genprotoName, ToConstraintIDs(context, plitem.Protocols.Keys, isPinvoke))); var netBundle = new NetTypeBundle("", genprotoName.Name, false, st [i].IsInOut, EntityType.ProtocolList); parms.Add(ToNamedParam(st [i], netBundle, i)); }
public CSMethod CompileMethod(FunctionDeclaration func, CSUsingPackages packs, string libraryPath, string mangledName, string functionName, bool isPinvoke, bool isFinal, bool isStatic) { isStatic = isStatic || func.IsExtension; var extraProtoArgs = new CSGenericTypeDeclarationCollection(); var extraProtoConstraints = new CSGenericConstraintCollection(); var args = typeMap.MapParameterList(func, func.ParameterLists.Last(), isPinvoke, false, extraProtoArgs, extraProtoConstraints); if (isPinvoke && func.ParameterLists.Count > 1) { var metaTypeBundle = new NetTypeBundle("SwiftRuntimeLibrary", "SwiftMetatype", false, false, EntityType.None); NetParam p = new NetParam("metaClass", metaTypeBundle); args.Add(p); } NetTypeBundle returnType = null; if (func.ReturnTypeSpec is ProtocolListTypeSpec plitem && !isPinvoke) { returnType = new NetTypeBundle("System", "object", false, false, EntityType.ProtocolList); }