fix(converter): prepend "val_" to avoid name confliction with register obj

This commit is contained in:
Wataru Otsubo 2025-05-20 18:09:10 +09:00
parent 3379babe12
commit e6f09d684a

View file

@ -514,9 +514,10 @@ impl Field {
})
}
/// Generate Field from Registers (piracy), guessing a lot of parameters.
/// Generate virtual Field from Registers node (piracy), guessing a lot of parameters.
pub(crate) fn from_xml_register_dom(node: Node) -> Result<Self, DomConversionError> {
let name = util::get_name(node)?;
// Prepend "val_" to avoid name confliction with struct for accessing values
let name = "val_".to_string() + &util::get_name(node)?;
let mask = match node.attribute("mask") {
Some(mask) => mask
.parse_prefixed_u32()
@ -539,6 +540,7 @@ impl Field {
node,
));
}
// Duplicated with parent (register) desc so should be removed, or add some comment?
let desc = node.attribute("desc").map(str::to_string);
let children = node
.children()