Ejemplo n.º 1
0
        internal override IEnumerable <AttributeData> GetCustomAttributesToEmit(CommonModuleCompilationState compilationState)
        {
            // [param]
            if (IsParams)
            {
                yield return(DeclaringCompilation.CreateParamsAttribute());
            }

            // [Nullable(1)] - does not return null
            if (HasNotNull && Type.IsReferenceType)
            {
                yield return(DeclaringCompilation.CreateNullableAttribute(NullableContextUtils.NotAnnotatedAttributeValue));
            }

            // [DefaultValue]
            if (DefaultValueField != null)
            {
                yield return(DeclaringCompilation.CreateDefaultValueAttribute(ContainingType, DefaultValueField));
            }

            //
            foreach (var attr in GetAttributes())
            {
                yield return(attr);
            }
        }
Ejemplo n.º 2
0
        internal override IEnumerable <AttributeData> GetCustomAttributesToEmit(CommonModuleCompilationState compilationState)
        {
            // params
            if (IsParams)
            {
                yield return(DeclaringCompilation.CreateParamsAttribute());
            }

            // TODO: preserve [NotNull]

            // [DefaultValue]
            if (DefaultValueField != null)
            {
                yield return(DeclaringCompilation.CreateDefaultValueAttribute(ContainingType, DefaultValueField));
            }

            //
            yield break;
        }
Ejemplo n.º 3
0
        internal override IEnumerable <AttributeData> GetCustomAttributesToEmit(CommonModuleCompilationState compilationState)
        {
            // params
            if (IsParams)
            {
                yield return(DeclaringCompilation.CreateParamsAttribute());
            }

            // TODO: preserve [NotNull]

            // [DefaultValue]
            if (this.Initializer is BoundArrayEx arr)
            {
                yield return(DeclaringCompilation.CreateDefaultValueAttribute(_container, arr));
            }

            //
            yield break;
        }
Ejemplo n.º 4
0
        internal override IEnumerable <AttributeData> GetCustomAttributesToEmit(CommonModuleCompilationState compilationState)
        {
            // [param]
            if (IsParams)
            {
                yield return(DeclaringCompilation.CreateParamsAttribute());
            }

            // [NotNull]
            if (IsNotNull && Type.IsReferenceType)
            {
                yield return(DeclaringCompilation.CreateNotNullAttribute());
            }

            // [DefaultValue]
            if (this.Initializer is BoundArrayEx arr)
            {
                yield return(DeclaringCompilation.CreateDefaultValueAttribute(Routine, arr));
            }

            //
            yield break;
        }
Ejemplo n.º 5
0
        internal override IEnumerable <AttributeData> GetCustomAttributesToEmit(CommonModuleCompilationState compilationState)
        {
            // [param]
            if (IsParams)
            {
                yield return(DeclaringCompilation.CreateParamsAttribute());
            }

            // [NotNull]
            if (IsNotNull && Type.IsReferenceType)
            {
                yield return(DeclaringCompilation.CreateNotNullAttribute());
            }

            // [DefaultValue]
            if (DefaultValueField != null)
            {
                yield return(DeclaringCompilation.CreateDefaultValueAttribute(ContainingType, DefaultValueField));
            }

            //
            yield break;
        }