Пример #1
0
def da_binOp_Eq_transform(insts: dal.InstGrp, loperand: object,
                          roperand: object) -> Snippet:

    s = Snippet()

    if not da_binOp_need_transformed(loperand, roperand):
        s.value = loperand == roperand
        return s
    else:
        l = insts.getFlag(insts.COMPARETOR_LEFT)
        if l is None:
            l = da_to_python_type(loperand)
        r = insts.getFlag(insts.COMPARETOR_RIGHT)
        if r is None:
            r = da_to_python_type(roperand)

        insts.setFlagWith(insts.COMPARETOR_LEFT, None)
        insts.setFlagWith(insts.COMPARETOR_RIGHT, None)

        ident = insts.new_da_var_ident()
        var = dal.Var(ident)

        eq_inst = dal.Equal(l, r, var)
        insts.addInst(eq_inst)
        s.addInst(var)

        ret = core.DBool()
        ret.compileInfo = 1
        ret.transInfo = TransformInfos()
        ret.transInfo.set_op_ret = var

        s.value = ret

    return s
Пример #2
0
 def __eq__(self, o: 'OInst') -> core.DBool:
     return core.DBool(self._inst_code == o._inst_code) and \
         core.DBool(self._args == o.args()) and \
         self._ret == o.ret()
Пример #3
0
 def __eq__(self, o: 'Var') -> core.DBool:
     return core.DBool(self.ident == o.ident)