예제 #1
0
 public LocalVariable(string name, MethodData methodData, Type type)
 {
     this.methodData = methodData;
     Type = type;
     localBuilder = methodData.Builder.GetILGenerator().DeclareLocal(type);
 }
예제 #2
0
 public void BeginMethod(string name)
 {
     currentMethod = classMethods[name];
     ilGenerator = currentMethod.Builder.GetILGenerator();
 }
예제 #3
0
 public ParameterVariable(int number, MethodData methodData, Type type)
 {
     Number = number;
     Type = type;
     MethodData = methodData;
 }
예제 #4
0
        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);
        }