vcd: handle enums with fields
All checks were successful
/ deps (push) Successful in 16s
/ test (push) Successful in 5m17s
/ deps (pull_request) Successful in 13s
/ test (pull_request) Successful in 5m23s

This commit is contained in:
Jacob Lifshay 2024-12-04 21:03:29 -08:00
parent 42afd2da0e
commit 643816d5b5
Signed by: programmerjake
SSH key fingerprint: SHA256:HnFTLGpSm4Q4Fj502oCFisjZSoakwEuTsJJMSke63RQ
2 changed files with 16 additions and 2 deletions

View file

@ -1428,7 +1428,7 @@ impl Compiler {
index: discriminant,
ty,
}),
name,
name: "$tag".intern(),
ty,
flow,
};

View file

@ -491,7 +491,21 @@ impl WriteTrace for TraceArray {
impl WriteTrace for TraceEnumWithFields {
fn write_trace<W: io::Write, A: Arg>(self, writer: &mut W, arg: A) -> io::Result<()> {
todo!()
let arg = arg.in_type();
let Self {
name,
discriminant,
non_empty_fields,
ty: _,
flow: _,
} = self;
write_vcd_scope(writer, "struct", &name, |writer| {
discriminant.write_trace(writer, arg)?;
for field in non_empty_fields {
field.write_trace(writer, arg)?;
}
Ok(())
})
}
}