Пример #1
0
        protected override TDeclarationNode AddField <TDeclarationNode>(TDeclarationNode destination, IFieldSymbol field, CodeGenerationOptions options, IList <bool> availableIndices)
        {
            CheckDeclarationNode <EnumDeclarationSyntax, TypeDeclarationSyntax, CompilationUnitSyntax>(destination);

            if (destination is EnumDeclarationSyntax)
            {
                return(Cast <TDeclarationNode>(EnumMemberGenerator.AddEnumMemberTo(Cast <EnumDeclarationSyntax>(destination), field, options)));
            }
            else if (destination is TypeDeclarationSyntax)
            {
                return(Cast <TDeclarationNode>(FieldGenerator.AddFieldTo(Cast <TypeDeclarationSyntax>(destination), field, options, availableIndices)));
            }
            else
            {
                return(Cast <TDeclarationNode>(FieldGenerator.AddFieldTo(Cast <CompilationUnitSyntax>(destination), field, options, availableIndices)));
            }
        }
Пример #2
0
 public override SyntaxNode CreateFieldDeclaration(IFieldSymbol field, CodeGenerationDestination destination, CodeGenerationOptions options)
 {
     return(destination == CodeGenerationDestination.EnumType
         ? EnumMemberGenerator.GenerateEnumMemberDeclaration(field, null, options)
         : (SyntaxNode)FieldGenerator.GenerateFieldDeclaration(field, destination, options));
 }