public FieldDeclarationSyntax Build() => SF.FieldDeclaration( GeneratorHelper.EmptyAttributeList(), SF.TokenList(this.modifiers), SF.VariableDeclaration( fieldType, SF.SeparatedList( this.variableNames.Select(n => SF.VariableDeclarator(n)))));
public ConstructorDeclarationSyntax BuildConstructor() { return(SyntaxFactory.ConstructorDeclaration( SyntaxFactory.List <AttributeListSyntax>(), SyntaxFactory.TokenList(modifiers), identifier, GeneratorHelper.ParameterList(parameters), default(ConstructorInitializerSyntax), blockBody, expressionBody)); }
public PropertyDeclarationSyntax Build(PropertyType propertyType = PropertyType.ReadonlyGet) { if (this.propertyType == PropertyType.ReadonlyGet) { return(SF.PropertyDeclaration( GeneratorHelper.EmptyAttributeList(), SF.TokenList(this.modifiers), this.type, default(ExplicitInterfaceSpecifierSyntax), GeneratorHelper.IdentifierToken(this.identifier), SF.AccessorList( GeneratorHelper.List( SF.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) .WithSemicolonToken(Tokens.Semicolon))), default(ArrowExpressionClauseSyntax), default(EqualsValueClauseSyntax) )); } throw new NotImplementedException(); }
public MethodDeclarationSyntax Build() { var methodDeclaration = SyntaxFactory.MethodDeclaration( SyntaxFactory.List <AttributeListSyntax>(), SyntaxFactory.TokenList(modifiers), returnType, default(ExplicitInterfaceSpecifierSyntax), identifier, typeParameters, GeneratorHelper.ParameterList(parameters), typeConstraints != null ? SyntaxFactory.List(typeConstraints) : SyntaxFactory.List <TypeParameterConstraintClauseSyntax>(), blockBody, expressionBody); if (expressionBody != null || (expressionBody == null && blockBody == null)) { methodDeclaration = methodDeclaration.WithSemicolonToken(Tokens.Semicolon); } return(methodDeclaration); }