Skip to content

Commit

Permalink
The field name is used in the enumerated_value name, if the enumerate…
Browse files Browse the repository at this point in the history
…d_value does not have a name.

Because a derived enumerate values in patched svd are written over by a base enumerated balue.
  • Loading branch information
seisyuu-hantatsushi committed Mar 3, 2024
1 parent 8fe79e6 commit 09c2712
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

- Fixed re-export of derived enumeration values

## [v0.32.0] - 2024-02-26

- Bump MSRV to 1.74
Expand Down
9 changes: 7 additions & 2 deletions src/generate/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,13 @@ pub fn fields(
if let Some(dpath) = dpath {
epath = Some(derive_enumerated_values(&mut ev, &dpath, &fpath, index)?);
// TODO: remove this hack
if let Some(epath) = epath.as_ref() {
ev = (*index.evs.get(epath).unwrap()).clone();
//if let Some(epath) = epath.as_ref() {
// ev = (*index.evs.get(epath).unwrap()).clone();
//}
// The field name is used in the enumerated_value name,
// if the enumerated_value does not have a name.
if ev.name == None {
ev.name = Some(f.name.clone());
}
} else if let Some(path) = fdpath.as_ref() {
epath = Some(
Expand Down

0 comments on commit 09c2712

Please sign in to comment.