@@ -136,6 +136,7 @@ protected MemberDeclarationSyntax CreateAsRootProperty()
136136 // public RootedRecursiveParent Root { get; }
137137 var property = SyntaxFactory . PropertyDeclaration ( GetRootedTypeSyntax ( this . applyTo ) , AsRootPropertyName . Identifier )
138138 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
139+ . AddAttributeLists ( PureAttributeList )
139140 . WithExpressionBody (
140141 SyntaxFactory . ArrowExpressionClause (
141142 // => new RootedRecursiveParent(this, this);
@@ -160,6 +161,7 @@ protected MemberDeclarationSyntax CreateWithRootMethod()
160161 // public RootedTemplateType WithRoot(TRecursiveParent root)
161162 var method = SyntaxFactory . MethodDeclaration ( GetRootedTypeSyntax ( this . applyTo ) , WithRootMethodName . Identifier )
162163 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
164+ . AddAttributeLists ( PureAttributeList )
163165 . AddParameterListParameters ( SyntaxFactory . Parameter ( rootParam . Identifier ) . WithType ( this . applyTo . RecursiveParent . TypeSyntax ) )
164166 . WithBody ( SyntaxFactory . Block (
165167 // var spine = root.GetSpine(this);
@@ -514,6 +516,7 @@ protected MethodDeclarationSyntax CreateWithMethod()
514516
515517 return SyntaxFactory . MethodDeclaration ( this . typeName , WithMethodName . Identifier )
516518 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
519+ . AddAttributeLists ( PureAttributeList )
517520 . WithParameterList ( this . generator . CreateParameterList ( this . applyTo . AllFields , ParameterStyle . Optional ) )
518521 . WithBody ( SyntaxFactory . Block (
519522 // this.ThrowIfDefault();
@@ -629,6 +632,7 @@ protected MethodDeclarationSyntax CreateCreateMethod()
629632
630633 return SyntaxFactory . MethodDeclaration ( this . typeName , CreateMethodName . Identifier )
631634 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) , SyntaxFactory . Token ( SyntaxKind . StaticKeyword ) )
635+ . AddAttributeLists ( PureAttributeList )
632636 . WithParameterList ( this . generator . CreateParameterList ( this . applyTo . AllFields , ParameterStyle . OptionalOrRequired ) )
633637 . WithBody ( SyntaxFactory . Block (
634638 SyntaxFactory . LocalDeclarationStatement ( SyntaxFactory . VariableDeclaration ( varType ) . AddVariables (
@@ -645,6 +649,7 @@ protected MethodDeclarationSyntax CreateFindMethod()
645649 // public RootedRecursiveType Find(uint identity)
646650 return SyntaxFactory . MethodDeclaration ( GetRootedTypeSyntax ( this . applyTo . RecursiveTypeFromFamily ) , SyntaxFactory . Identifier ( nameof ( RecursiveTypeExtensions . Find ) ) )
647651 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
652+ . AddAttributeLists ( PureAttributeList )
648653 . AddParameterListParameters (
649654 SyntaxFactory . Parameter ( IdentityParameterName . Identifier ) . WithType ( IdentityFieldTypeSyntax ) )
650655 . WithBody ( SyntaxFactory . Block (
@@ -664,6 +669,7 @@ protected MethodDeclarationSyntax CreateTryFindMethod()
664669 var valueParameter = SyntaxFactory . IdentifierName ( "value" ) ;
665670 return SyntaxFactory . MethodDeclaration ( SyntaxFactory . PredefinedType ( SyntaxFactory . Token ( SyntaxKind . BoolKeyword ) ) , SyntaxFactory . Identifier ( nameof ( RecursiveTypeExtensions . TryFind ) ) )
666671 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
672+ . AddAttributeLists ( PureAttributeList )
667673 . AddParameterListParameters (
668674 SyntaxFactory . Parameter ( IdentityParameterName . Identifier ) . WithType ( IdentityFieldTypeSyntax ) ,
669675 SyntaxFactory . Parameter ( valueParameter . Identifier ) . WithType ( GetRootedTypeSyntax ( this . applyTo . RecursiveTypeFromFamily ) ) . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . OutKeyword ) ) )
@@ -901,6 +907,7 @@ protected MemberDeclarationSyntax[] CreateWithPropertyMethods()
901907 SyntaxFactory . MethodDeclaration ( GetRootedTypeSyntax ( this . applyTo ) , DefineWithMethodsPerPropertyGen . WithPropertyMethodPrefix + field . NameAsProperty )
902908 . AddParameterListParameters ( SyntaxFactory . Parameter ( valueParam . Identifier ) . WithType ( field . TypeSyntax ) )
903909 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
910+ . AddAttributeLists ( PureAttributeList )
904911 . WithBody ( SyntaxFactory . Block (
905912 CallThrowIfDefaultMethod ,
906913 // var mutatedLeaf = this.greenNode.With<#= field.NamePascalCase #>(value);
@@ -932,6 +939,7 @@ protected MethodDeclarationSyntax[] CreateToTypeMethods()
932939 GetRootedTypeSyntax ( targetType . type ) ,
933940 TypeConversionGen . GetToTypeMethodName ( targetType . type . TypeSymbol . Name ) . Identifier )
934941 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
942+ . AddAttributeLists ( PureAttributeList )
935943 . WithParameterList ( this . generator . CreateParameterList ( targetType . type . GetFieldsBeyond ( targetType . CommonAncestor ) , ParameterStyle . OptionalOrRequired ) )
936944 . WithBody ( SyntaxFactory . Block (
937945 // var newGreenNode = this.greenNode.To<#= targetType.TypeName #>(<# WriteArguments(familyType.GetFieldsBeyond(commonAncestor), ArgSource.Argument); #>);
@@ -987,6 +995,7 @@ protected MethodDeclarationSyntax CreateDictionaryHelperMethod(MetaField field,
987995 GetRootedTypeSyntax ( this . applyTo ) ,
988996 methodName . Identifier )
989997 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
998+ . AddAttributeLists ( PureAttributeList )
990999 . WithParameterList ( methodParameters )
9911000 . WithBody ( SyntaxFactory . Block (
9921001 CallThrowIfDefaultMethod ,
@@ -1015,6 +1024,7 @@ protected MethodDeclarationSyntax CreateCollectionHelperMethodStarter(MetaField
10151024 GetRootedTypeSyntax ( this . applyTo ) ,
10161025 SyntaxFactory . Identifier ( verb + term ) )
10171026 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
1027+ . AddAttributeLists ( PureAttributeList )
10181028 . WithBody ( SyntaxFactory . Block (
10191029 CallThrowIfDefaultMethod ,
10201030 // var mutatedLeaf = this.greenNode.Verb<#= plural #>(values);
@@ -1084,6 +1094,7 @@ protected MemberDeclarationSyntax[] CreateCollectionHelperMethods()
10841094 returnType ,
10851095 SyntaxFactory . Identifier ( "Add" + singular ) )
10861096 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
1097+ . AddAttributeLists ( PureAttributeList )
10871098 . AddParameterListParameters ( SyntaxFactory . Parameter ( valueParam . Identifier ) . WithType ( this . applyTo . RecursiveTypeFromFamily . TypeSyntax ) )
10881099 . WithBody ( SyntaxFactory . Block (
10891100 CallThrowIfDefaultMethod ,
@@ -1129,6 +1140,7 @@ protected MemberDeclarationSyntax[] CreateCollectionHelperMethods()
11291140 GetRootedTypeSyntax ( this . applyTo ) ,
11301141 SyntaxFactory . Identifier ( "Remove" + plural ) )
11311142 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
1143+ . AddAttributeLists ( PureAttributeList )
11321144 . WithParameterList ( SyntaxFactory . ParameterList ( ) )
11331145 . WithBody ( SyntaxFactory . Block (
11341146 CallThrowIfDefaultMethod ,
@@ -1184,6 +1196,7 @@ protected MethodDeclarationSyntax CreateChangesSinceMethod()
11841196 Syntax . IReadOnlyListOf ( diffTypeName ) ,
11851197 ChangesSinceMethodName . Identifier )
11861198 . AddModifiers ( SyntaxFactory . Token ( SyntaxKind . PublicKeyword ) )
1199+ . AddAttributeLists ( PureAttributeList )
11871200 . AddParameterListParameters (
11881201 SyntaxFactory . Parameter ( priorVersionParam . Identifier ) . WithType ( GetRootedTypeSyntax ( this . applyTo ) ) )
11891202 . WithBody ( SyntaxFactory . Block (
0 commit comments