55using System ;
66using System . Collections . Generic ;
77using System . Linq ;
8- using System . Text ;
98
109namespace BeaKona . AutoInterfaceGenerator
1110{
@@ -445,14 +444,14 @@ public void WritePropertyDefinition(SourceBuilder builder, IPropertySymbol prope
445444 {
446445 IMemberInfo reference = references . First ( ) ;
447446
448- if ( property . GetMethod is IMethodSymbol )
447+ if ( property . GetMethod is not null )
449448 {
450449 builder . AppendIndentation ( ) ;
451450 builder . Append ( "get => " ) ;
452451 this . WritePropertyCall ( builder , reference , property , scope , SemanticFacts . IsNullable ( this . Compilation , property . Type ) , true ) ;
453452 builder . AppendLine ( ';' ) ;
454453 }
455- if ( property . SetMethod is IMethodSymbol )
454+ if ( property . SetMethod is not null )
456455 {
457456 builder . AppendIndentation ( ) ;
458457 builder . Append ( "set => " ) ;
@@ -462,7 +461,7 @@ public void WritePropertyDefinition(SourceBuilder builder, IPropertySymbol prope
462461 }
463462 else
464463 {
465- if ( property . GetMethod is IMethodSymbol )
464+ if ( property . GetMethod is not null )
466465 {
467466 builder . AppendIndentation ( ) ;
468467 if ( getterTemplate != null )
@@ -503,7 +502,7 @@ public void WritePropertyDefinition(SourceBuilder builder, IPropertySymbol prope
503502 builder . AppendLine ( ';' ) ;
504503 }
505504 }
506- if ( property . SetMethod is IMethodSymbol )
505+ if ( property . SetMethod is not null )
507506 {
508507 builder . AppendIndentation ( ) ;
509508 builder . AppendLine ( "set" ) ;
@@ -872,6 +871,16 @@ private string GetSourceIdentifier(ISymbol symbol)
872871 {
873872 return "this ";
874873 }
874+ else if ( symbol is INamespaceSymbol ns )
875+ {
876+ return ns. Name ;
877+ //return string.Join("+", ns.ConstituentNamespaces.Select(i => i.Name));
878+ //return $"<{@namespace.Name};{symbol}>" + this.GetSourceIdentifier(@namespace.Name);
879+ }
880+ else if ( symbol . DeclaringSyntaxReferences . Length == 0 )
881+ {
882+ return symbol. Name ;
883+ }
875884 else
876885 {
877886 foreach ( SyntaxReference syntaxReference in symbol . DeclaringSyntaxReferences )
@@ -941,19 +950,14 @@ private string GetSourceIdentifier(ISymbol symbol)
941950 }
942951 else if ( syntax is NamespaceDeclarationSyntax @namespace )
943952 {
944- return this . GetSourceIdentifier ( @namespace . Name ) ;
953+ throw new NotSupportedException ( syntax . GetType ( ) . ToString ( ) ) ;
945954 }
946955 else
947956 {
948957 throw new NotSupportedException( syntax . GetType ( ) . ToString ( ) ) ;
949958 }
950959 }
951960
952- if ( symbol . DeclaringSyntaxReferences . Length == 0 )
953- {
954- return symbol. Name ;
955- }
956-
957961 throw new NotSupportedException( ) ;
958962 }
959963 }
0 commit comments