@@ -136,6 +136,7 @@ protected MemberDeclarationSyntax CreateAsRootProperty()
136
136
// public RootedRecursiveParent Root { get; }
137
137
var property = SyntaxFactory . PropertyDeclaration ( GetRootedTypeSyntax ( this . applyTo ) , AsRootPropertyName . Identifier )
138
138
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
139
+ . AddAttributeLists ( PureAttributeList )
139
140
. WithExpressionBody (
140
141
SyntaxFactory . ArrowExpressionClause (
141
142
// => new RootedRecursiveParent(this, this);
@@ -160,6 +161,7 @@ protected MemberDeclarationSyntax CreateWithRootMethod()
160
161
// public RootedTemplateType WithRoot(TRecursiveParent root)
161
162
var method = SyntaxFactory . MethodDeclaration ( GetRootedTypeSyntax ( this . applyTo ) , WithRootMethodName . Identifier )
162
163
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
164
+ . AddAttributeLists ( PureAttributeList )
163
165
. AddParameterListParameters ( SyntaxFactory . Parameter ( rootParam . Identifier ) . WithType ( this . applyTo . RecursiveParent . TypeSyntax ) )
164
166
. WithBody ( SyntaxFactory . Block (
165
167
// var spine = root.GetSpine(this);
@@ -514,6 +516,7 @@ protected MethodDeclarationSyntax CreateWithMethod()
514
516
515
517
return SyntaxFactory . MethodDeclaration ( this . typeName , WithMethodName . Identifier )
516
518
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
519
+ . AddAttributeLists ( PureAttributeList )
517
520
. WithParameterList ( this . generator . CreateParameterList ( this . applyTo . AllFields , ParameterStyle . Optional ) )
518
521
. WithBody ( SyntaxFactory . Block (
519
522
// this.ThrowIfDefault();
@@ -629,6 +632,7 @@ protected MethodDeclarationSyntax CreateCreateMethod()
629
632
630
633
return SyntaxFactory . MethodDeclaration ( this . typeName , CreateMethodName . Identifier )
631
634
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) , SyntaxFactory . Token ( SyntaxKind . StaticKeyword ) )
635
+ . AddAttributeLists ( PureAttributeList )
632
636
. WithParameterList ( this . generator . CreateParameterList ( this . applyTo . AllFields , ParameterStyle . OptionalOrRequired ) )
633
637
. WithBody ( SyntaxFactory . Block (
634
638
SyntaxFactory . LocalDeclarationStatement ( SyntaxFactory . VariableDeclaration ( varType ) . AddVariables (
@@ -645,6 +649,7 @@ protected MethodDeclarationSyntax CreateFindMethod()
645
649
// public RootedRecursiveType Find(uint identity)
646
650
return SyntaxFactory . MethodDeclaration ( GetRootedTypeSyntax ( this . applyTo . RecursiveTypeFromFamily ) , SyntaxFactory . Identifier ( nameof ( RecursiveTypeExtensions . Find ) ) )
647
651
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
652
+ . AddAttributeLists ( PureAttributeList )
648
653
. AddParameterListParameters (
649
654
SyntaxFactory . Parameter ( IdentityParameterName . Identifier ) . WithType ( IdentityFieldTypeSyntax ) )
650
655
. WithBody ( SyntaxFactory . Block (
@@ -664,6 +669,7 @@ protected MethodDeclarationSyntax CreateTryFindMethod()
664
669
var valueParameter = SyntaxFactory . IdentifierName ( "value" ) ;
665
670
return SyntaxFactory . MethodDeclaration ( SyntaxFactory . PredefinedType ( SyntaxFactory . Token ( SyntaxKind . BoolKeyword ) ) , SyntaxFactory . Identifier ( nameof ( RecursiveTypeExtensions . TryFind ) ) )
666
671
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
672
+ . AddAttributeLists ( PureAttributeList )
667
673
. AddParameterListParameters (
668
674
SyntaxFactory . Parameter ( IdentityParameterName . Identifier ) . WithType ( IdentityFieldTypeSyntax ) ,
669
675
SyntaxFactory . Parameter ( valueParameter . Identifier ) . WithType ( GetRootedTypeSyntax ( this . applyTo . RecursiveTypeFromFamily ) ) . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . OutKeyword ) ) )
@@ -901,6 +907,7 @@ protected MemberDeclarationSyntax[] CreateWithPropertyMethods()
901
907
SyntaxFactory . MethodDeclaration ( GetRootedTypeSyntax ( this . applyTo ) , DefineWithMethodsPerPropertyGen . WithPropertyMethodPrefix + field . NameAsProperty )
902
908
. AddParameterListParameters ( SyntaxFactory . Parameter ( valueParam . Identifier ) . WithType ( field . TypeSyntax ) )
903
909
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
910
+ . AddAttributeLists ( PureAttributeList )
904
911
. WithBody ( SyntaxFactory . Block (
905
912
CallThrowIfDefaultMethod ,
906
913
// var mutatedLeaf = this.greenNode.With<#= field.NamePascalCase #>(value);
@@ -932,6 +939,7 @@ protected MethodDeclarationSyntax[] CreateToTypeMethods()
932
939
GetRootedTypeSyntax ( targetType . type ) ,
933
940
TypeConversionGen . GetToTypeMethodName ( targetType . type . TypeSymbol . Name ) . Identifier )
934
941
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
942
+ . AddAttributeLists ( PureAttributeList )
935
943
. WithParameterList ( this . generator . CreateParameterList ( targetType . type . GetFieldsBeyond ( targetType . CommonAncestor ) , ParameterStyle . OptionalOrRequired ) )
936
944
. WithBody ( SyntaxFactory . Block (
937
945
// var newGreenNode = this.greenNode.To<#= targetType.TypeName #>(<# WriteArguments(familyType.GetFieldsBeyond(commonAncestor), ArgSource.Argument); #>);
@@ -987,6 +995,7 @@ protected MethodDeclarationSyntax CreateDictionaryHelperMethod(MetaField field,
987
995
GetRootedTypeSyntax ( this . applyTo ) ,
988
996
methodName . Identifier )
989
997
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
998
+ . AddAttributeLists ( PureAttributeList )
990
999
. WithParameterList ( methodParameters )
991
1000
. WithBody ( SyntaxFactory . Block (
992
1001
CallThrowIfDefaultMethod ,
@@ -1015,6 +1024,7 @@ protected MethodDeclarationSyntax CreateCollectionHelperMethodStarter(MetaField
1015
1024
GetRootedTypeSyntax ( this . applyTo ) ,
1016
1025
SyntaxFactory . Identifier ( verb + term ) )
1017
1026
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
1027
+ . AddAttributeLists ( PureAttributeList )
1018
1028
. WithBody ( SyntaxFactory . Block (
1019
1029
CallThrowIfDefaultMethod ,
1020
1030
// var mutatedLeaf = this.greenNode.Verb<#= plural #>(values);
@@ -1084,6 +1094,7 @@ protected MemberDeclarationSyntax[] CreateCollectionHelperMethods()
1084
1094
returnType ,
1085
1095
SyntaxFactory . Identifier ( "Add" + singular ) )
1086
1096
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
1097
+ . AddAttributeLists ( PureAttributeList )
1087
1098
. AddParameterListParameters ( SyntaxFactory . Parameter ( valueParam . Identifier ) . WithType ( this . applyTo . RecursiveTypeFromFamily . TypeSyntax ) )
1088
1099
. WithBody ( SyntaxFactory . Block (
1089
1100
CallThrowIfDefaultMethod ,
@@ -1129,6 +1140,7 @@ protected MemberDeclarationSyntax[] CreateCollectionHelperMethods()
1129
1140
GetRootedTypeSyntax ( this . applyTo ) ,
1130
1141
SyntaxFactory . Identifier ( "Remove" + plural ) )
1131
1142
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
1143
+ . AddAttributeLists ( PureAttributeList )
1132
1144
. WithParameterList ( SyntaxFactory . ParameterList ( ) )
1133
1145
. WithBody ( SyntaxFactory . Block (
1134
1146
CallThrowIfDefaultMethod ,
@@ -1184,6 +1196,7 @@ protected MethodDeclarationSyntax CreateChangesSinceMethod()
1184
1196
Syntax . IReadOnlyListOf ( diffTypeName ) ,
1185
1197
ChangesSinceMethodName . Identifier )
1186
1198
. AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
1199
+ . AddAttributeLists ( PureAttributeList )
1187
1200
. AddParameterListParameters (
1188
1201
SyntaxFactory . Parameter ( priorVersionParam . Identifier ) . WithType ( GetRootedTypeSyntax ( this . applyTo ) ) )
1189
1202
. WithBody ( SyntaxFactory . Block (
0 commit comments