when generating #defines for values of type variables, distinguish between variables of type 'Type' and others

This commit is contained in:
Michael Sippel 2025-05-10 16:28:58 +02:00
parent 4a705241fe
commit 6f0a0f5927
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -171,23 +171,21 @@ impl LdmcCTargetMorph {
let mut c_source = String::new();
for (ty_id, kind) in morph.type_args.iter() {
if let laddertypes::TypeID::Var(var_id) = ty_id {
//if morph_inst.get_type().strip_halo().src_type.contains_var(*var_id) ||
//morph_inst.get_type().strip_halo().dst_type.contains_var(*var_id) {
if let Some(val) = σ.get(ty_id) {
let type_var_value = get_c_repr_type(dict, val);
let type_var_value =
if kind == "Type" {
get_c_repr_type(dict, val)
} else {
encode_type_to_value(dict, val)
};
c_source.push_str(&format!(" #define {} {}\n", dict.get_typename(&ty_id).unwrap(), type_var_value));
}
//}
}
}
c_source.push_str(&morph.c_source);
for (ty_id, kind) in morph.type_args.iter() {
if let laddertypes::TypeID::Var(var_id) = ty_id {
//if morph_inst.get_type().strip_halo().src_type.contains_var(*var_id) ||
//morph_inst.get_type().strip_halo().dst_type.contains_var(*var_id) {
c_source.push_str(&format!("\n #undef {}", dict.get_typename(&ty_id).unwrap()));
//}
}
}