Пример #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);
        }