public bool CheckFunc(string name, List <string> args) { if (!Contains(name)) { throw new Exception($"Cannot find function '{name}'"); } var argsType = TypesTools.ToTypes(args); var item = Get(name); return(Funcs.Exists(model => model.ArgsType.Contains(argsType))); }
public void Add(string name, List <string> argsType) { var types = TypesTools.ToTypes(argsType); if (Contains(name)) { Get(name).ArgsType.Add(types); } else { if (CheckFunc(name, types)) { throw new Exception($"Function '{name}' with such arguments is already declared"); } Funcs.Add(new FuncModel(name, types)); } }