public void FunctionDef(FunctionDef e) { Type[] param = new Type[e.Count]; DoVars = new Hashtable(); for (int i = 0; i < e.Count; i++){ param[i] = (Type)e.Params[i]; } //DescriptorInfo di = new DescriptorInfo(param); //di.SetReturnType(e.ExpType); //di.MethodAttributes = MethodAttributes.Static | MethodAttributes.Public; methodb = tb.DefineMethod(e.Name, MethodAttributes.Static | MethodAttributes.Public, e.ExpType, param); Functions.Add(e.Name, methodb); ILGenerator ilmain = il; il = methodb.GetILGenerator(); e.Body.Visit(this); il.Emit(OpCodes.Ret); il = ilmain; }
public void FunctionDef(FunctionDef e) { CurrentFuncDef = new Hashtable(); DoVars = new Hashtable(); CurrentFuncName = e.Name; //Functions.Add(e.Name, e); e.Body.Visit(this); for(int i = 0; i < e.Params.Count; i++){ if(CurrentFuncDef[e.Params[i]] == null){ e.Params[i] = typeof(void); } else{ e.Params[i] = CurrentFuncDef[e.Params[i]]; //Now Params have Types } } CurrentFuncDef = null; CurrentFuncName = null; DoVars = null; e.ExpType = e.Body.ExpType; Functions.Add(e.Name, e); }