feat: add code messages when using expects on constrs

This commit is contained in:
microproofs
2024-01-02 21:59:22 -05:00
committed by Kasey
parent 71cfb6f6af
commit aa51ce3e3e
3 changed files with 16 additions and 6 deletions

View File

@@ -89,6 +89,7 @@ pub enum Air {
},
AssertConstr {
constr_index: usize,
msg: String,
},
AssertBool {
is_true: bool,

View File

@@ -127,6 +127,7 @@ pub enum AirStatement {
AssertConstr {
constr_index: usize,
constr: Box<AirTree>,
msg: String,
},
AssertBool {
is_true: bool,
@@ -493,11 +494,12 @@ impl AirTree {
value: value.into(),
})
}
pub fn assert_constr_index(constr_index: usize, constr: AirTree) -> AirTree {
pub fn assert_constr_index(constr_index: usize, constr: AirTree, msg: String) -> AirTree {
AirTree::Statement {
statement: AirStatement::AssertConstr {
constr_index,
constr: constr.into(),
msg,
},
hoisted_over: None,
}
@@ -946,9 +948,11 @@ impl AirTree {
AirStatement::AssertConstr {
constr,
constr_index,
msg,
} => {
air_vec.push(Air::AssertConstr {
constr_index: *constr_index,
msg: msg.clone(),
});
constr.create_air_vec(air_vec);
}