Ejemplo n.º 1
0
        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)));
        }
Ejemplo n.º 2
0
        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));
            }
        }