/// <summary>
        /// Creates a constructor symbol that can be used to describe a constructor declaration.
        /// </summary>
        public static IMethodSymbol CreateConstructorSymbol(IList <AttributeData> attributes, Accessibility accessibility, SymbolModifiers modifiers, string typeName, IList <IParameterSymbol> parameters, IList <SyntaxNode> statements = null, IList <SyntaxNode> baseConstructorArguments = null, IList <SyntaxNode> thisConstructorArguments = null)
        {
            var result = new CodeGenerationConstructorSymbol(null, attributes, accessibility, modifiers, parameters);

            CodeGenerationConstructorInfo.Attach(result, typeName, statements, baseConstructorArguments, thisConstructorArguments);
            return(result);
        }
Example #2
0
        /// <summary>
        /// Creates a constructor symbol that can be used to describe a constructor declaration.
        /// </summary>
        public static IMethodSymbol CreateConstructorSymbol(
            ImmutableArray <AttributeData> attributes,
            Accessibility accessibility,
            DeclarationModifiers modifiers,
            string typeName,
            ImmutableArray <IParameterSymbol> parameters,
            ImmutableArray <SyntaxNode> statements = default,
            ImmutableArray <SyntaxNode> baseConstructorArguments = default,
            ImmutableArray <SyntaxNode> thisConstructorArguments = default,
            bool isPrimaryConstructor = false
            )
        {
            var result = new CodeGenerationConstructorSymbol(
                null,
                attributes,
                accessibility,
                modifiers,
                parameters
                );

            CodeGenerationConstructorInfo.Attach(
                result,
                isPrimaryConstructor,
                modifiers.IsUnsafe,
                typeName,
                statements,
                baseConstructorArguments,
                thisConstructorArguments
                );
            return(result);
        }
Example #3
0
        protected override CodeGenerationSymbol Clone()
        {
            var result = new CodeGenerationConstructorSymbol(this.ContainingType, this.GetAttributes(), this.DeclaredAccessibility, this.Modifiers, this.Parameters);

            CodeGenerationConstructorInfo.Attach(result,
                                                 CodeGenerationConstructorInfo.GetTypeName(this),
                                                 CodeGenerationConstructorInfo.GetStatements(this),
                                                 CodeGenerationConstructorInfo.GetBaseConstructorArgumentsOpt(this),
                                                 CodeGenerationConstructorInfo.GetThisConstructorArgumentsOpt(this));

            return(result);
        }