public bool GetMethodOnIt(CoolType type, string method, out CoolMethod CoolMethod) { if (!Methods.ContainsKey(type)) { Methods[type] = new List <CoolMethod>(); } CoolMethod = Methods[type].FirstOrDefault(x => x.Name == method); return(CoolMethod != null); }
public bool GetMethodIfDef(CoolType type, string method, out CoolMethod CoolMethod) { CoolMethod = new NullMethod(method); if (type is NullType) { return(true); } if (type is SelfType selftype) { return(GetMethodIfDef(selftype.ContextType, method, out CoolMethod)); } if (GetMethodOnIt(type, method, out CoolMethod)) { return(true); } if (type.Parent != null) { return(GetMethodIfDef(type.Parent, method, out CoolMethod)); } return(false); }