public static string GetObjCName(string name, int argCount) { OperatorInfo match = OperatorMapping.FirstOrDefault(x => x.MetadataName == name || x.FriendlyName == name); if (match != null && argCount == match.ArgumentCount) { return(match.ObjCName); } return(null); }
public static bool MatchesOperatorFriendlyName(MethodInfo method) { OperatorInfo possibleMatch = OperatorMapping.FirstOrDefault(x => x.FriendlyName == method.Name && x.ArgumentCount == method.GetParameters().Length); if (possibleMatch != null) { // To be considered a "friendly" operator it must have first argument and return its type // TODO - Is there a better huristic var param = method.GetParameters(); if (method.ReturnType == method.DeclaringType && param[0].ParameterType == method.DeclaringType) { return(true); } } return(false); }