Beispiel #1
0
        internal TypeParameterSymbol MakeSymbol(
            int ordinal,
            IList <TypeParameterBuilder> builders,
            BindingDiagnosticBag diagnostics
            )
        {
            var syntaxNode = (TypeParameterSyntax)_syntaxRef.GetSyntax();
            var result     = new SourceTypeParameterSymbol(
                _owner,
                syntaxNode.Identifier.ValueText,
                ordinal,
                syntaxNode.VarianceKeyword.VarianceKindFromToken(),
                ToLocations(builders),
                ToSyntaxRefs(builders)
                );

            // SPEC: A type parameter [of a type] cannot have the same name as the type itself.
            if (result.Name == result.ContainingSymbol.Name)
            {
                diagnostics.Add(
                    ErrorCode.ERR_TypeVariableSameAsParent,
                    result.Locations[0],
                    result.Name
                    );
            }

            return(result);
        }
Beispiel #2
0
        internal TypeParameterSymbol MakeSymbol(int ordinal, IList <TypeParameterBuilder> builders, DiagnosticBag diagnostics)
        {
            var syntaxNode = (TypeParameterSyntax)this.syntaxRef.GetSyntax();
            var result     = new SourceTypeParameterSymbol(
                this.owner,
                syntaxNode.Identifier.ValueText,
                ordinal,
                syntaxNode.VarianceKeyword.VarianceKindFromToken(),
                ToLocations(builders),
                ToSyntaxRefs(builders));

            if (result.Name == result.ContainingSymbol.Name)
            {
                diagnostics.Add(ErrorCode.ERR_TypeVariableSameAsParent, result.Locations[0], result.Name);
            }

            return(result);
        }
        internal TypeParameterSymbol MakeSymbol(int ordinal, IList<TypeParameterBuilder> builders, DiagnosticBag diagnostics)
        {
            var syntaxNode = (TypeParameterSyntax)this.syntaxRef.GetSyntax();
            var result = new SourceTypeParameterSymbol(
                this.owner,
                syntaxNode.Identifier.ValueText,
                ordinal,
                syntaxNode.VarianceKeyword.VarianceKindFromToken(),
                ToLocations(builders),
                ToSyntaxRefs(builders));

            if (result.Name == result.ContainingSymbol.Name)
            {
                diagnostics.Add(ErrorCode.ERR_TypeVariableSameAsParent, result.Locations[0], result.Name);
            }

            return result;
        }