Esempio n. 1
0
 public override SyntaxNode CreateMethodDeclaration(
     IMethodSymbol method, CodeGenerationDestination destination, CodeGenerationOptions options)
 {
     if (method.IsConstructor())
     {
         return(ConstructorGenerator.GenerateConstructorDeclaration(method, destination, options));
     }
     else if (method.IsDestructor())
     {
         return(DestructorGenerator.GenerateDestructorDeclaration(method, destination, options));
     }
     else
     {
         return(MethodGenerator.GenerateMethodDeclaration(method, destination, options));
     }
 }
Esempio n. 2
0
        public override SyntaxNode CreateMethodDeclaration(
            IMethodSymbol method, CodeGenerationDestination destination, CodeGenerationOptions options)
        {
            // Synthesized methods for properties/events are not things we actually generate
            // declarations for.
            if (method.AssociatedSymbol is IEventSymbol)
            {
                return(null);
            }

            if (method.AssociatedSymbol is IPropertySymbol)
            {
                // we will ignore the method if the associated property can be generated.
                var property = (IPropertySymbol)method.AssociatedSymbol;
                if (PropertyGenerator.CanBeGenerated(property))
                {
                    return(null);
                }
            }

            if (method.IsConstructor())
            {
                return(ConstructorGenerator.GenerateConstructorDeclaration(
                           method, destination, Workspace, options, options.ParseOptions));
            }
            else if (method.IsDestructor())
            {
                return(DestructorGenerator.GenerateDestructorDeclaration(method, destination, options));
            }
            else if (method.IsUserDefinedOperator())
            {
                return(OperatorGenerator.GenerateOperatorDeclaration(
                           method, destination, Workspace, options, options.ParseOptions));
            }
            else if (method.IsConversion())
            {
                return(ConversionGenerator.GenerateConversionDeclaration(
                           method, destination, Workspace, options, options.ParseOptions));
            }
            else
            {
                return(MethodGenerator.GenerateMethodDeclaration(
                           method, destination, Workspace, options, options.ParseOptions));
            }
        }