Refactor AssignmentKind to allow backpassing on both let and expect.

The 3rd kind of assignment kind (Bind) is gone and now reflected through a boolean parameter. Note that this parameter is completely erased by the type-checker so that the rest of the pipeline (i.e. code-generation) doesn't have to make any assumption. They simply can't see a backpassing let or expect.
This commit is contained in:
KtorZ
2024-03-10 23:04:07 +01:00
parent df898bf239
commit 435dd0d213
27 changed files with 198 additions and 113 deletions

View File

@@ -559,7 +559,7 @@ impl<'a> CodeGenerator<'a> {
&subject_type,
AssignmentProperties {
value_type: subject.tipo(),
kind: AssignmentKind::Let,
kind: AssignmentKind::let_(),
remove_unused: false,
full_check: false,
msg_func: None,
@@ -843,7 +843,7 @@ impl<'a> CodeGenerator<'a> {
) -> AirTree {
assert!(
match &value {
AirTree::Var { name, .. } if props.kind == AssignmentKind::Let => {
AirTree::Var { name, .. } if props.kind.is_let() => {
name != "_"
}
_ => true,
@@ -2812,7 +2812,7 @@ impl<'a> CodeGenerator<'a> {
&actual_type,
AssignmentProperties {
value_type: data(),
kind: AssignmentKind::Expect,
kind: AssignmentKind::expect(),
remove_unused: false,
full_check: true,
msg_func,