Exemplo n.º 1
0
        public override void RenderIL_Load(ILCanvas canvas)
        {
            BasicType basic_type = value_type.GetBasicType();

            switch (basic_type)
            {
            case BasicType.Bool: canvas.Emit_Ldc_I4(0); break;

            case BasicType.SByte: canvas.Emit_Ldc_I4(0); break;

            case BasicType.Short: canvas.Emit_Ldc_I4(0); break;

            case BasicType.Int: canvas.Emit_Ldc_I4(0); break;

            case BasicType.Long: canvas.Emit_Ldc_I8(0); break;

            case BasicType.Byte: canvas.Emit_Ldc_U4(0); break;

            case BasicType.UShort: canvas.Emit_Ldc_U4(0); break;

            case BasicType.UInt: canvas.Emit_Ldc_U4(0); break;

            case BasicType.ULong: canvas.Emit_Ldc_U8(0); break;

            case BasicType.Float: canvas.Emit_Ldc_R4(0.0f); break;

            case BasicType.Double: canvas.Emit_Ldc_R8(0.0); break;

            case BasicType.Char: canvas.Emit_Ldc_I4(0); break;

            case BasicType.String: canvas.Emit_Ldstr(""); break;

            case BasicType.Array: canvas.Emit_Ldnull(); break;

            case BasicType.Enum: canvas.Emit_Ldc_I4(0); break;

            case BasicType.Class: canvas.Emit_Ldnull(); break;

            case BasicType.Struct:
                canvas.UseLocal(value_type, delegate(ILLocal local) {
                    local.RenderIL_LoadAddress(canvas);
                    canvas.Emit_Initobj(value_type);
                    local.RenderIL_Load(canvas);
                });
                break;

            default: throw new UnaccountedBranchException("basic_type", basic_type);
            }
        }
Exemplo n.º 2
0
 public override void RenderIL_Load(ILCanvas canvas)
 {
     canvas.Emit_Ldc_R4(constant);
 }