示例#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 override ConstData GetDataBlock(T0Comp ctx)
    {
        TPointerBlob bp = val.ptr as TPointerBlob;

        return(bp == null ? null : bp.Blob);
    }
示例#3
0
    internal override bool Equals(TPointerBase tp)
    {
        TPointerBlob tb = tp as TPointerBlob;

        return(tb != null && Blob == tb.Blob);
    }