fix: switch from unwrap to if let to allow boolean when

fix: test 67 fixed to take in ByteArray instead of string literal
This commit is contained in:
Kasey White
2023-02-20 04:37:33 -05:00
parent 2394438a91
commit 70164282f8
4 changed files with 33 additions and 23 deletions

View File

@@ -756,16 +756,29 @@ impl<'a> CodeGenerator<'a> {
scope.clone(),
);
let data_type =
lookup_data_type_by_tipo(self.data_types.clone(), subject_type).unwrap();
let data_type = lookup_data_type_by_tipo(self.data_types.clone(), subject_type);
if data_type.constructors.len() > 1 {
ir_stack.push(Air::Clause {
scope,
tipo: subject_type.clone(),
complex_clause: *clause_properties.is_complex_clause(),
subject_name,
});
if let Some(data_type) = data_type {
if data_type.constructors.len() > 1 {
ir_stack.push(Air::Clause {
scope,
tipo: subject_type.clone(),
complex_clause: *clause_properties.is_complex_clause(),
subject_name,
});
} else {
ir_stack.push(Air::Clause {
scope: scope.clone(),
tipo: subject_type.clone(),
complex_clause: *clause_properties.is_complex_clause(),
subject_name,
});
ir_stack.push(Air::Int {
scope,
value: "0".to_string(),
});
}
} else {
ir_stack.push(Air::Clause {
scope: scope.clone(),
@@ -773,11 +786,6 @@ impl<'a> CodeGenerator<'a> {
complex_clause: *clause_properties.is_complex_clause(),
subject_name,
});
ir_stack.push(Air::Int {
scope,
value: "0".to_string(),
});
}
}
ClauseProperties::ListClause {