public void Visit(FuncCall funcCall) { Console.Write(funcCall.Name); Console.Write("("); int argsCntr = funcCall.Arguments.Count; foreach (AddExpression arg in funcCall.Arguments) { arg.Accept(this); if (argsCntr != 1) { Console.Write(","); argsCntr--; } } Console.Write(")"); }
public void Visit(FuncCall funcCall) { if (Program.FuncDefinitions.ContainsKey(funcCall.Name)) { // Check parameters count if (funcCall.Arguments.Count == Program.FuncDefinitions[funcCall.Name].Parameters.Count) { foreach (INode arg in funcCall.Arguments) { arg.Accept(this); } Program.FuncDefinitions[funcCall.Name].Accept(this); } else { throw new ExecutorException($"Wrong number of arguments in function call called {funcCall.Name}"); } } else { throw new ExecutorException($"Did not find function called {funcCall.Name}"); } }