Skip to content

Commit

Permalink
Fix name duplication for inline choice types gh#75
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerkindt committed Apr 27, 2022
1 parent c4f55dc commit e8aa191
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions asn1rs-model/src/model/rust/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,16 @@ impl Model<Rust> {
extended_after_index: choice.extension_after_index(),
};

for ChoiceVariant { name, r#type, tag } in choice.variants() {
let rust_name = format!("{}{}", name, ctxt.struct_or_enum_name(name));
for ChoiceVariant {
name: variant_name,
r#type,
tag,
} in choice.variants()
{
let rust_name = format!("{}{}", name, ctxt.struct_or_enum_name(variant_name));
let rust_role =
Self::definition_type_to_rust_type(&rust_name, r#type, *tag, ctxt);
let rust_field_name = ctxt.variant_name(name);
let rust_field_name = ctxt.variant_name(variant_name);
enumeration.variants.push(
DataVariant::from_name_type(rust_field_name, rust_role).with_tag_opt(*tag),
);
Expand Down

0 comments on commit e8aa191

Please sign in to comment.