when generating #defines for values of type variables, distinguish between variables of type 'Type' and others
This commit is contained in:
parent
4a705241fe
commit
6f0a0f5927
1 changed files with 10 additions and 12 deletions
|
@ -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()));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue