private CallExp CreateCallExp(List <Node> parameters) { parameters.CheckLength(2); var node = new CallExp { MethodName = (TokenNode)parameters[0], Arguments = ((NodeList)parameters[1])?.Nodes.Cast <Expression>().ToList() }; node.AddChildren(node.MethodName); node.AddChildren(node.Arguments?.ToArray()); return(node); }
public void CallExp(CallExp e) { for (int i = 0; i < e.Params.Length; i++) { e.Params[i].Visit(this); } if (e.System) { il.Emit(OpCodes.Call, ((typeof(LispRuntime)).GetMethod(e.FunctionName))); } else { il.Emit(OpCodes.Call, (MethodInfo)Functions[e.FunctionName]); } }
public void CallExp(CallExp e) { if (!e.System) { if (e.FunctionName == CurrentFuncName) { for (int i = 0; i < e.Params.Length; i++) { e.Params[i].Visit(this); } e.ExpType = typeof(void); //Recursive Function. Return type unknown. } else { FunctionDef f = (FunctionDef)Functions[e.FunctionName]; for (int i = 0; i < e.Params.Length; i++) { e.Params[i].Visit(this); CheckAny(ref e.Params[i], (Type)f.Params[i]); } e.ExpType = f.ExpType; } } else { FunctionDef f = (FunctionDef)Functions[e.FunctionName]; for (int i = 0; i < e.Params.Length; i++) { e.Params[i].Visit(this); CheckAny(ref e.Params[i], (Type)f.Params[i]); } //ExpType of System functions is set while parsing itself. //e.ExpType = (Type)Functions[e.FunctionName]; } }