예제 #1
0
        protected virtual void _Generate(AstNodeExprIndirect Indirect)
        {
            Generate(Indirect.PointerExpression);
            var PointerType = Indirect.PointerExpression.Type.GetElementType();

            if (false)
            {
            }

            else if (PointerType == typeof(byte))
            {
                Emit(OpCodes.Ldind_U1);
            }
            else if (PointerType == typeof(ushort))
            {
                Emit(OpCodes.Ldind_U2);
            }
            else if (PointerType == typeof(uint))
            {
                Emit(OpCodes.Ldind_U4);
            }
            else if (PointerType == typeof(ulong))
            {
                Emit(OpCodes.Ldind_I8);
            }

            else if (PointerType == typeof(sbyte))
            {
                Emit(OpCodes.Ldind_I1);
            }
            else if (PointerType == typeof(short))
            {
                Emit(OpCodes.Ldind_I2);
            }
            else if (PointerType == typeof(int))
            {
                Emit(OpCodes.Ldind_I4);
            }
            else if (PointerType == typeof(long))
            {
                Emit(OpCodes.Ldind_I8);
            }

            else if (PointerType == typeof(float))
            {
                Emit(OpCodes.Ldind_R4);
            }
            else if (PointerType == typeof(double))
            {
                Emit(OpCodes.Ldind_R8);
            }

            else
            {
                throw (new NotImplementedException("Can't load indirect value"));
            }
        }
예제 #2
0
 protected virtual void _Generate(AstNodeExprIndirect assign)
 {
     Output.Write("*(");
     Generate(assign.PointerExpression);
     Output.Write(")");
 }