def __init__(self, conv_prop, eq_prop, cprop_uid, eprop_uid, lhs, rhs, pred_func, abstract_expr=None): self.conv_prop = conv_prop self.eq_prop = eq_prop self.cprop_uid = cprop_uid self.eprop_uid = eprop_uid self.lhs = lhs self.rhs = rhs self.pred_func = pred_func constructor_args = [lhs, rhs, pred_func] if eq_prop: constructor_args.append( self.dynamic_vars_to_holder( eq_prop, 'Equals_Data_{}'.format(eq_prop.uid))) else: constructor_args.append('No_Equals_Data_Default') constructor_args.append(sloc_info_arg(abstract_expr.location)) super().__init__('Bind_Result', 'Bind_{}_{}.Create'.format(cprop_uid, eprop_uid), T.Equation, constructor_args, abstract_expr=abstract_expr)
def construct(self): # The equation constructor takes an Ada array as a parameter, not our # access to record: unwrap it. relation_array = untyped_literal_expr( 'Relation_Array ({}.Items)', [construct(self.equation_array, T.Equation.array)]) return CallExpr( "Logic_Boolean_Op", f"Solver.Create_{self.kind_name}", T.Equation, [relation_array, sloc_info_arg(self.location)], abstract_expr=self)
def construct(self): """ Construct a resolved expression for this. :rtype: IfExpr """ def construct_op(op): return construct(op, lambda t: t in (T.Bool, T.Equation), "Operands of binary logic operator must be of " "boolean or equation type, got {expr_type}") lhs, rhs = map(construct_op, [self.lhs, self.rhs]) check_source_language( lhs.type is rhs.type, "Left and right operands to binary logic " "operator should have the same type" ) if lhs.type is T.Bool: # Boolean case if self.kind == self.AND: then = rhs else_then = LiteralExpr('False', T.Bool) else: then = LiteralExpr('True', T.Bool) else_then = rhs return If.Expr(lhs, then, else_then) else: # Equation case kind_name = self.kind.capitalize() return CallExpr( '{}_Pred'.format(kind_name), 'Logic_{}'.format(kind_name), T.Equation, [lhs, rhs, sloc_info_arg(self.location)], abstract_expr=self )
def construct(self): return CallExpr('False_Rel', 'Solver.Create_False', T.Equation, [sloc_info_arg(self.location)])
def _render_pre(self): return render('properties/domain_ada', expr=self, sloc_info_arg=sloc_info_arg(self.abstract_expr.location))
def construct(self): return CallExpr('Logic_False', 'False_Rel', T.Equation, [sloc_info_arg(self.location)])