@@ -428,7 +428,7 @@ void ProcessElementBody(BamlElement root, BamlElement elem) {
428428 AddTypeSigReference ( sig , reference ) ;
429429 }
430430 else
431- AnalyzePropertyPath ( value ) ;
431+ AnalyzePropertyPath ( value , s => txt . Value = s ) ;
432432 }
433433 }
434434 }
@@ -479,7 +479,7 @@ void ProcessConverter(PropertyWithConverterRecord rec, TypeDef type) {
479479 // Umm... Again nothing to do, DP already won't be renamed.
480480 }
481481 else if ( converter . FullName == "System.Windows.PropertyPathConverter" ) {
482- AnalyzePropertyPath ( rec . Value ) ;
482+ AnalyzePropertyPath ( rec . Value , s => rec . Value = s ) ;
483483 }
484484 else if ( converter . FullName == "System.Windows.Markup.RoutedEventConverter" ) {
485485 ;
@@ -501,7 +501,7 @@ void ProcessConverter(PropertyWithConverterRecord rec, TypeDef type) {
501501 attrName = attrInfo . Item2 . Name ;
502502
503503 if ( attrName == "DisplayMemberPath" ) {
504- AnalyzePropertyPath ( rec . Value ) ;
504+ AnalyzePropertyPath ( rec . Value , s => rec . Value = s ) ;
505505 }
506506 else if ( attrName == "Source" ) {
507507 string declType = null ;
@@ -581,52 +581,59 @@ Tuple<IDnlibDef, AttributeInfoRecord, TypeDef> AnalyzeAttributeReference(TypeDef
581581 return Tuple . Create ( retDef , rec , retType == null ? null : retType . ResolveTypeDefThrow ( ) ) ;
582582 }
583583
584- void AnalyzePropertyPath ( string path ) {
585- var parsedPath = PathParser . Parse ( path ) ;
586- foreach ( var part in parsedPath ) {
587- switch ( part . type ) {
584+ void AnalyzePropertyPath ( string path , Action < string > updateAction ) {
585+ var pathUpdater = new PropertyPathUpdater ( path , updateAction ) ;
586+ foreach ( var part in pathUpdater ) {
587+ switch ( part . Type ) {
588588 case SourceValueType . Property :
589- // This is a property reference. This may be directly the name of a property or a reference by
590- // with the type to the property
591- // Simple Property: "TestProperty"
592- // Property with Type: "(local:DataClass.TestProperty)"
593-
594- var typeName = part . GetTypeName ( ) ;
595- var propertyName = part . GetPropertyName ( ) ;
596- if ( ! string . IsNullOrWhiteSpace ( typeName ) ) {
597- var sig = ResolveType ( typeName , out var prefix ) ;
598- if ( sig != null && context . Modules . Contains ( ( ModuleDefMD ) sig . ToBasicTypeDefOrRef ( ) . ResolveTypeDefThrow ( ) . Module ) ) {
599- var reference = new BAMLPathTypeReference ( xmlnsCtx , sig , part ) ;
600- AddTypeSigReference ( sig , reference ) ;
601- break ;
602- }
603- }
604-
605- // Reaching this point means that the type reference was either not present or failed to
606- // resolve. In this case every property with the matching name will be flagged so it does not
607- // get renamed.
608- if ( properties . TryGetValue ( propertyName , out var candidates ) )
609- foreach ( var property in candidates )
610- service . SetCanRename ( property , false ) ;
611-
589+ AnalyzePropertyPathProperty ( part ) ;
612590 break ;
613591 case SourceValueType . Indexer :
614592 // This is the indexer part of a property reference.
615- foreach ( var indexerArg in part . paramList ) {
616- if ( ! string . IsNullOrWhiteSpace ( indexerArg . parenString ) ) {
617- var sig = ResolveType ( indexerArg . parenString , out var prefix ) ;
618- if ( sig != null && context . Modules . Contains ( ( ModuleDefMD ) sig . ToBasicTypeDefOrRef ( ) . ResolveTypeDefThrow ( ) . Module ) ) {
619- var reference = new BAMLPathTypeReference ( xmlnsCtx , sig , part ) ;
620- AddTypeSigReference ( sig , reference ) ;
621- break ;
622- }
623- }
624- }
593+ AnalyzePropertyPathIndexer ( part ) ;
625594 break ;
626595 }
627596 }
628597 }
629598
599+ void AnalyzePropertyPathProperty ( PropertyPathPartUpdater part ) {
600+ // This is a property reference. This may be directly the name of a property or a reference by
601+ // with the type to the property
602+ // Simple Property: "TestProperty"
603+ // Property with Type: "(local:DataClass.TestProperty)"
604+
605+ var typeName = part . GetTypeName ( ) ;
606+ var propertyName = part . GetPropertyName ( ) ;
607+ if ( ! string . IsNullOrWhiteSpace ( typeName ) ) {
608+ var sig = ResolveType ( typeName , out var prefix ) ;
609+ if ( sig != null && context . Modules . Contains ( ( ModuleDefMD ) sig . ToBasicTypeDefOrRef ( ) . ResolveTypeDefThrow ( ) . Module ) ) {
610+ var reference = new BAMLPathTypeReference ( xmlnsCtx , sig , part ) ;
611+ AddTypeSigReference ( sig , reference ) ;
612+ return ;
613+ }
614+ }
615+
616+ // Reaching this point means that the type reference was either not present or failed to
617+ // resolve. In this case every property with the matching name will be flagged so it does not
618+ // get renamed.
619+ if ( properties . TryGetValue ( propertyName , out var candidates ) )
620+ foreach ( var property in candidates )
621+ service . SetCanRename ( property , false ) ;
622+ }
623+
624+ void AnalyzePropertyPathIndexer ( PropertyPathPartUpdater part ) {
625+ foreach ( var indexerArg in part . ParamList ) {
626+ if ( ! string . IsNullOrWhiteSpace ( indexerArg . ParenString ) ) {
627+ var sig = ResolveType ( indexerArg . ParenString , out var prefix ) ;
628+ if ( sig != null && context . Modules . Contains ( ( ModuleDefMD ) sig . ToBasicTypeDefOrRef ( ) . ResolveTypeDefThrow ( ) . Module ) ) {
629+ var reference = new BAMLPathTypeReference ( xmlnsCtx , sig , indexerArg ) ;
630+ AddTypeSigReference ( sig , reference ) ;
631+ break ;
632+ }
633+ }
634+ }
635+ }
636+
630637 class DummyAssemblyRefFinder : IAssemblyRefFinder {
631638 readonly AssemblyDef assemblyDef ;
632639
0 commit comments