public MemberDeclarationSyntax GetMemberDeclarationSyntax() { var hasAttributes = AttributeListCollection != null; var hasModifiers = ModifierList != null; var declaration = ConstructorDeclaration( Identifier.GetSyntaxToken((!hasAttributes && !hasModifiers) ? DocumentationCommentList : null)); if (hasAttributes) { declaration = declaration.WithAttributeLists( AttributeListCollection.GetAttributeListSyntaxList(DocumentationCommentList)); } if (hasModifiers) { declaration = declaration.WithModifiers( ModifierList.GetSyntaxTokenList(hasAttributes ? null : DocumentationCommentList)); } if (ConstructorBaseInitializer != null) { declaration = declaration.WithInitializer( ConstructorBaseInitializer.GetConstructorInitializerSyntax()); } if (ParameterList != null) { declaration = declaration.WithParameterList( ParameterList.GetParameterListSyntax()); } return(declaration.WithBody(Block.GetBlockSyntax())); }
private XmlAttributeSyntax GetXmlNameAttributeSyntax() => XmlNameAttribute( XmlName( Identifier.GetSyntaxToken()), Token(SyntaxKind.DoubleQuoteToken), Value.GetIdentifierNameSyntax(), Token(SyntaxKind.DoubleQuoteToken));
protected override BaseTypeDeclarationSyntax GetTypeDeclarationSyntax() { var hasAttributes = AttributeListCollection != null; var hasModifiers = ModifierList != null; var declaration = EnumDeclaration( Identifier.GetSyntaxToken((!hasAttributes && !hasModifiers) ? DocumentationCommentList : null)); if (hasAttributes) { declaration = declaration.WithAttributeLists( AttributeListCollection.GetAttributeListSyntaxList(DocumentationCommentList)); } if (hasModifiers) { declaration = declaration.WithModifiers( ModifierList.GetSyntaxTokenList(hasAttributes ? null : DocumentationCommentList)); } if (BaseList != null) { declaration = declaration.WithBaseList( BaseList.GetBaseListSyntax()); } return(declaration.WithMembers( EnumMemberList.GetEnumMembers())); }
public MemberDeclarationSyntax GetMemberDeclarationSyntax() { var hasAttributes = AttributeListCollection != null; var hasModifiers = ModifierList != null; var declarator = VariableDeclarator( Identifier.GetSyntaxToken()); if (Initializer != null) { declarator = declarator.WithInitializer( EqualsValueClause( Initializer.GetExpressionSyntax())); } var declaration = FieldDeclaration( VariableDeclaration( IdentifierName( Identifier.GetSyntaxToken((!hasAttributes && !hasModifiers) ? DocumentationCommentList : null))) .WithVariables( SingletonSeparatedList(declarator))); if (hasAttributes) { declaration = declaration.WithAttributeLists( AttributeListCollection.GetAttributeListSyntaxList(DocumentationCommentList)); } if (hasModifiers) { declaration = declaration.WithModifiers( ModifierList.GetSyntaxTokenList(hasAttributes ? null : DocumentationCommentList)); } return(declaration); }
public EnumMemberDeclarationSyntax GetEnumMemberDeclaration() => EqualsValue == null ? EnumMemberDeclaration(Identifier.GetSyntaxToken(DocumentationCommentList)) : EnumMemberDeclaration(Identifier.GetSyntaxToken(DocumentationCommentList)) .WithEqualsValue( EqualsValueClause( LiteralExpression( SyntaxKind.NumericLiteralExpression, Literal(EqualsValue.Value))));
public SimpleBaseTypeSyntax GetSimpleBaseTypeSyntax() => TypeArgumentListId == null ? SimpleBaseType( ParseTypeName(Identifier.Name.Value)) : SimpleBaseType( GenericName( Identifier.GetSyntaxToken()) .WithTypeArgumentList( TypeArgumentList.GetTypeArgumentListSyntax()));
protected override BaseTypeDeclarationSyntax GetTypeDeclarationSyntax() { var hasAttributes = AttributeListCollection != null; var hasModifiers = ModifierList != null; var declaration = StructDeclaration( Identifier.GetSyntaxToken((!hasAttributes && !hasModifiers) ? DocumentationCommentList : null)); if (hasAttributes) { declaration = declaration.WithAttributeLists( AttributeListCollection.GetAttributeListSyntaxList(DocumentationCommentList)); } if (hasModifiers) { declaration = declaration.WithModifiers( ModifierList.GetSyntaxTokenList(hasAttributes ? null : DocumentationCommentList)); } if (BaseList != null) { declaration = declaration.WithBaseList( BaseList.GetBaseListSyntax()); } if (ConstraintClauseList != null) { declaration = declaration.WithConstraintClauses( ConstraintClauseList.GetConstraintClauses()); } if (TypeParameterList != null) { declaration = declaration.WithTypeParameterList( TypeParameterList.GetTypeParameterListSyntax()); } // Get members var memberList = new List <MemberDeclarationSyntax>(); if (FieldList != null) { memberList.AddRange(FieldList.GetMemberDeclarationSyntax()); } if (ConstructorList != null) { memberList.AddRange(ConstructorList.GetMemberDeclarationSyntax()); } if (PropertyList != null) { memberList.AddRange(PropertyList.GetMemberDeclarationSyntax()); } if (MethodList != null) { memberList.AddRange(MethodList.GetMemberDeclarationSyntax()); } return(memberList.Count == 1 ? declaration.WithMembers( SingletonList(memberList.First())) : declaration.WithMembers( List(memberList))); }
private XmlAttributeSyntax GetXmlTextAttributeSyntax() => XmlTextAttribute( XmlName( Identifier.GetSyntaxToken()), Token(SyntaxKind.DoubleQuoteToken), Token(SyntaxKind.DoubleQuoteToken)) .WithTextTokens( TokenList( XmlTextLiteral( TriviaList(), Value.Name.Value, Value.Name.Value, TriviaList())));
public MemberDeclarationSyntax GetMemberDeclarationSyntax() { var hasAttributes = AttributeListCollection != null; var hasModifiers = ModifierList != null; var declaration = MethodDeclaration( IdentifierName( Type.GetSyntaxToken((!hasAttributes && !hasModifiers) ? DocumentationCommentList : null)), Identifier.GetSyntaxToken()); if (hasAttributes) { declaration = declaration.WithAttributeLists( AttributeListCollection.GetAttributeListSyntaxList(DocumentationCommentList)); } if (hasModifiers) { declaration = declaration.WithModifiers( ModifierList.GetSyntaxTokenList(hasAttributes ? null : DocumentationCommentList)); } if (ParameterList != null) { declaration = declaration.WithParameterList( ParameterList.GetParameterListSyntax()); } if (TypeParameterList != null) { declaration = declaration.WithTypeParameterList( TypeParameterList.GetTypeParameterListSyntax()); } return((ArrowClauseExpressionValue != null) ? declaration .WithExpressionBody( ArrowExpressionClause( ArrowClauseExpressionValue.GetExpressionSyntax())) .WithSemicolonToken( Token(SyntaxKind.SemicolonToken)) : (Block != null) ? declaration.WithBody( Block.GetBlockSyntax()) : declaration.WithSemicolonToken( Token(SyntaxKind.SemicolonToken))); }
public ParameterSyntax GetParameterSyntax() { var parameter = Parameter( Identifier.GetSyntaxToken()) .WithType( Type.GetTypeSyntax()); if (AttributeListCollection != null) { parameter = parameter.WithAttributeLists( AttributeListCollection.GetAttributeListSyntaxList()); } if (DefaultValue != null) { parameter = parameter.WithDefault( EqualsValueClause( DefaultValue.GetExpressionSyntax())); } return(parameter); }
public MemberDeclarationSyntax GetMemberDeclarationSyntax() { var hasAttributes = AttributeListCollection != null; var hasModifiers = ModifierList != null; var declaration = PropertyDeclaration( IdentifierName( Type.GetSyntaxToken((!hasAttributes && !hasModifiers) ? DocumentationCommentList : null)), Identifier.GetSyntaxToken()); if (hasAttributes) { declaration = declaration.WithAttributeLists( AttributeListCollection.GetAttributeListSyntaxList(DocumentationCommentList)); } if (hasModifiers) { declaration = declaration.WithModifiers( ModifierList.GetSyntaxTokenList(hasAttributes ? null : DocumentationCommentList)); } return(declaration.WithAccessorList( AccessorList.GetAccessorListSyntax())); }
public IEnumerable <XmlNodeSyntax> GetXmlNodeSyntaxList() => new XmlNodeSyntax[] { XmlText().WithTextTokens(GetTextTokens()), XmlExampleElement( SingletonList <XmlNodeSyntax>( XmlText() .WithTextTokens( TokenList( XmlTextLiteral( TriviaList(), Text.Value, Text.Value, TriviaList()))))) .WithStartTag( XmlElementStartTag( XmlName( Identifier.GetSyntaxToken()))) .WithEndTag( XmlElementEndTag( XmlName( Identifier.GetSyntaxToken()))) };
public TypeParameterSyntax GetTypeParameterSyntax() => TypeParameter(Identifier.GetSyntaxToken());
public DestructorDeclarationSyntax GetDestructorDeclarationSyntax() => DestructorDeclaration(Identifier.GetSyntaxToken()) .WithBody(Block.GetBlockSyntax());