コード例 #1
0
    internal override CodeElement ToCodeElement()
    {
        if (val.ptr == null)
        {
            return(new CodeElementUIntInt(1, val.Int));
        }
        TPointerXT xt = val.ptr as TPointerXT;

        if (xt != null)
        {
            if (val.x != 0)
            {
                throw new Exception(
                          "Cannot compile XT: non-zero offset");
            }
            return(new CodeElementUIntInt(1, xt.Target.Slot));
        }
        TPointerBlob bp = val.ptr as TPointerBlob;

        if (bp != null)
        {
            return(new CodeElementUIntInt(1,
                                          val.x + bp.Blob.Address));
        }
        TPointerExpr cx = val.ptr as TPointerExpr;

        if (cx != null)
        {
            return(new CodeElementUIntExpr(1, cx, val.x));
        }
        throw new Exception(String.Format(
                                "Cannot embed constant (type = {0})",
                                val.ptr.GetType().FullName));
    }
コード例 #2
0
 internal CodeElementUIntExpr(uint val,
                              TPointerExpr cx, int off) : base()
 {
     this.val = val;
     this.cx  = cx;
     this.off = off;
 }