Ejemplo n.º 1
0
        public void Prepare(CompilingContext c, Statement statement)
        {
            c.IL.Emit(OpCodes.Ldarg_0);
            c.IL.Emit(OpCodes.Ldfld, GetField(c, statement));

            VariableArray v = (VariableArray)statement;

            foreach (NumStatement n in v.Dimensions)
            {
                c.Factory.Execute(c, n);
                c.IL.Emit(OpCodes.Conv_I4);
            }
        }
Ejemplo n.º 2
0
        public override Type Execute(CompilingContext c, Statement statement)
        {
            Prepare(c, statement);

            VariableArray arr       = (VariableArray)statement;
            var           callTypes = new Type[arr.Dimensions.Count];

            for (int i = 0; i < callTypes.Length; ++i)
            {
                callTypes[i] = typeof(int);
            }

            c.IL.Emit(OpCodes.Call, GetField(c, statement).FieldType.GetMethod("Get", callTypes));
            return(typeof(VarType));
        }
Ejemplo n.º 3
0
        public void SetValue(CompilingContext c, Statement statement)
        {
            Type          fieldType = GetField(c, statement).FieldType;
            VariableArray arr       = (VariableArray)statement;
            var           callTypes = new Type[arr.Dimensions.Count + 1];

            for (int i = 0; i < callTypes.Length - 1; ++i)
            {
                callTypes[i] = typeof(int);
            }

            callTypes[callTypes.Length - 1] = typeof(VarType);
            MethodInfo set = fieldType.GetMethod("Set", callTypes);

            c.IL.Emit(OpCodes.Call, set);
        }
Ejemplo n.º 4
0
        internal void AddArray <T, RetType>()
        {
            var v = new VariableArray <T, RetType>();

            _factory.Add(v.Type.Name, v);
        }