77using dnlib . DotNet ;
88
99namespace Confuser . Renamer . References {
10- internal sealed class BAMLPathTypeReference : INameReference < TypeDef > {
10+ internal sealed class BAMLPathTypeReference : INameReference < TypeDef > , INameReference < PropertyDef > {
1111 PropertyPathPartUpdater ? PropertyInfo { get ; }
1212 PropertyPathIndexUpdater ? IndexerInfo { get ; }
1313 private readonly TypeSig sig ;
14+ readonly PropertyDef prop ;
1415 private readonly BAMLAnalyzer . XmlNsContext xmlnsCtx ;
1516
1617 public bool ShouldCancelRename => false ;
@@ -26,8 +27,10 @@ private BAMLPathTypeReference(BAMLAnalyzer.XmlNsContext xmlnsCtx, TypeSig sig) {
2627 public BAMLPathTypeReference ( BAMLAnalyzer . XmlNsContext xmlnsCtx , TypeSig sig , PropertyPathIndexUpdater indexerInfo ) : this ( xmlnsCtx , sig ) =>
2728 IndexerInfo = indexerInfo ;
2829
29- public BAMLPathTypeReference ( BAMLAnalyzer . XmlNsContext xmlnsCtx , TypeSig sig , PropertyPathPartUpdater propertyInfo ) : this ( xmlnsCtx , sig ) =>
30+ public BAMLPathTypeReference ( BAMLAnalyzer . XmlNsContext xmlnsCtx , TypeSig sig , PropertyDef property , PropertyPathPartUpdater propertyInfo ) : this ( xmlnsCtx , sig ) {
3031 PropertyInfo = propertyInfo ;
32+ prop = property ;
33+ }
3134
3235 public bool UpdateNameReference ( ConfuserContext context , INameService service ) {
3336 string name = sig . ReflectionName ;
@@ -43,7 +46,7 @@ public bool UpdateNameReference(ConfuserContext context, INameService service) {
4346 else {
4447 Debug . Assert ( PropertyInfo != null , nameof ( PropertyInfo ) + " != null" ) ;
4548 var info = PropertyInfo . Value ;
46- var propertyName = info . GetPropertyName ( ) ;
49+ var propertyName = prop ? . Name ?? info . GetPropertyName ( ) ;
4750 var newName = string . Format ( CultureInfo . InvariantCulture , "({0}.{1})" , name , propertyName ) ;
4851 if ( string . Equals ( info . Name , newName , StringComparison . Ordinal ) ) return false ;
4952 info . Name = newName ;
0 commit comments