@@ -554,12 +554,11 @@ pub fn fields(
554
554
let inline = quote ! { #[ inline( always) ] } ;
555
555
for & f in fields. iter ( ) {
556
556
let mut f = f. clone ( ) ;
557
- let mut fpath = None ;
558
- let dpath = f. derived_from . take ( ) ;
559
- if let Some ( dpath) = dpath {
560
- fpath = derive_field ( & mut f, & dpath, rpath, index) ?;
557
+ let mut fdpath = None ;
558
+ if let Some ( dpath) = f. derived_from . take ( ) {
559
+ fdpath = derive_field ( & mut f, & dpath, rpath, index) ?;
561
560
}
562
- let fpath = fpath . unwrap_or_else ( || rpath. new_field ( & f. name ) ) ;
561
+ let fpath = rpath. new_field ( & f. name ) ;
563
562
// TODO(AJM) - do we need to do anything with this range type?
564
563
let BitRange { offset, width, .. } = f. bit_range ;
565
564
@@ -601,10 +600,12 @@ pub fn fields(
601
600
let dpath = ev. derived_from . take ( ) ;
602
601
if let Some ( dpath) = dpath {
603
602
epath = Some ( derive_enumerated_values ( & mut ev, & dpath, & fpath, index) ?) ;
604
- }
605
- // TODO: remove this hack
606
- if let Some ( epath) = epath. as_ref ( ) {
607
- ev = ( * index. evs . get ( epath) . unwrap ( ) ) . clone ( ) ;
603
+ // TODO: remove this hack
604
+ if let Some ( epath) = epath. as_ref ( ) {
605
+ ev = ( * index. evs . get ( epath) . unwrap ( ) ) . clone ( ) ;
606
+ }
607
+ } else if let Some ( path) = fdpath. as_ref ( ) {
608
+ epath = Some ( path. new_enum ( ev. name . clone ( ) . unwrap_or_else ( || path. name . clone ( ) ) ) ) ;
608
609
}
609
610
lookup_results. push ( ( ev, epath) ) ;
610
611
}
0 commit comments