示例#1
0
        private SourceTypeInfo(
            TypeDeclarationSyntax syntaxNode,
            Location syntaxLocation,
            INamedTypeSymbol typeSymbol,
            bool hasEquatableAttribute,
            bool hasComparableAttribute,
            IReadOnlyList <INamedTypeSymbol> enclosingTypes,
            IReadOnlyList <SourceMemberInfo> members,
            NullableContext nullableContext,
            GenerateOptions options,
            KnownTypes knownTypes)
            : base(
                typeSymbol,
                knownTypes)
        {
            this.SyntaxNode             = syntaxNode;
            this.SyntaxLocation         = syntaxLocation;
            this.HasEquatableAttribute  = hasEquatableAttribute;
            this.HasComparableAttribute = hasComparableAttribute;
            this.EnclosingTypes         = enclosingTypes;
            this.Members         = members;
            this.NullableContext = nullableContext;
            this.GenerateOptions = options;
            this.NamespaceName   = typeSymbol.ContainingNamespace?.GetFullName() ?? string.Empty;

            var baseTypeSymbol = typeSymbol.BaseType;

            if (!typeSymbol.IsValueType &&
                baseTypeSymbol is not null)
            {
                this.BaseType = new BaseTypeInfo(
                    baseTypeSymbol,
                    knownTypes);
            }
        }
        internal ComparableObjectGenerator(
            GenerateOptions options)
        {
            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            this._options = options;
        }