public LocalVariable(string name, MethodData methodData, Type type) { this.methodData = methodData; Type = type; localBuilder = methodData.Builder.GetILGenerator().DeclareLocal(type); }
public void BeginMethod(string name) { currentMethod = classMethods[name]; ilGenerator = currentMethod.Builder.GetILGenerator(); }
public ParameterVariable(int number, MethodData methodData, Type type) { Number = number; Type = type; MethodData = methodData; }
public void RegisterMethod(string name, Types returnType, params Parameter[] parameters) { Type[] types = (from p in parameters select p.Type.ClrType).ToArray(); var method = currentType.DefineMethod(name, MethodAttributes.Static | MethodAttributes.Public, typeof(object), types); MethodData methodData = new MethodData(method, returnType, new Dictionary<string, IVariable>()); int x = 0; foreach (var parameter in parameters) { methodData.Varables.Add(parameter.Name, new ParameterVariable(x, methodData, parameter.Type.ClrType)); x++; } classMethods.Add(name, methodData); }