示例#1
0
    def __enter__(self):
        push_constraint_stmt(self.stmt)
        push_constraint_scope(self.stmt)
        model = self.arr_model
        #        return expr(ExprArraySubscriptModel())

        push_foreach_arr(self.arr)

        idx_term = foreach.idx_term_c(self.stmt.index)
        if self.arr_model.is_scalar:
            it_term = foreach.it_term_c(
                ExprArraySubscriptModel(ExprFieldRefModel(model),
                                        ExprFieldRefModel(self.stmt.index)))
        else:
            self.arr.t._int_field_info.root_e = ExprArraySubscriptModel(
                ExprFieldRefModel(model), ExprFieldRefModel(self.stmt.index))
            it_term = self.arr.t

        if self.idx and self.it:
            return (idx_term, it_term)
        else:
            if self.it:
                return it_term
            else:
                return idx_term
示例#2
0
 def __enter__(self):
     if not in_constraint_scope():
         raise Exception("Attempting to use if_then constraint outside constraint scope")
     
     last_stmt = last_constraint_stmt()
     if last_stmt == None or not isinstance(last_stmt, ConstraintIfElseModel):
         raise Exception("Attempting to use else_then where it doesn't follow if_then/else_if")
     
     # Need to find where to think this in
     while last_stmt.false_c != None:
         last_stmt = last_stmt.false_c
         
     stmt = ConstraintScopeModel()
     last_stmt.false_c = stmt
     push_constraint_scope(stmt)
示例#3
0
    def __enter__(self):
        push_constraint_stmt(self.stmt)
        push_constraint_scope(self.stmt)

        idx_term = foreach.idx_term_c(self.stmt.index)
        it_term = foreach.it_term_c(
            ExprArraySubscriptModel(self.arr_ref_e,
                                    ExprFieldRefModel(self.stmt.index)))

        if self.idx and self.it:
            return (idx_term, it_term)
        else:
            if self.it:
                return it_term
            else:
                return idx_term
示例#4
0
 def __enter__(self):
     push_constraint_stmt(self.stmt)
     push_constraint_scope(self.stmt)
示例#5
0
 def __enter__(self):
     if self.stmt is not None:
         self.stmt.true_c = ConstraintScopeModel()
         push_constraint_scope(self.stmt.true_c)
示例#6
0
 def __enter__(self):
     # Go into 'expression' mode
     enter_expr_mode()
     push_constraint_scope(ConstraintBlockModel("inline"))
     return self