Inheritance: Microsoft.Cci.ICustomAttribute
        public override ImmutableArray <AttributeData> GetAttributes()
        {
            var attrs = base.GetAttributes();

            // IsInitFieldsOnly => InitFieldsOnlyCtorAttribute
            if (IsInitFieldsOnly)
            {
                // [PhpFieldsOnlyCtorAttribute]
                if (_lazyPhpFieldsOnlyCtorAttribute == null)
                {
                    _lazyPhpFieldsOnlyCtorAttribute = new SynthesizedAttributeData(
                        DeclaringCompilation.CoreMethods.Ctors.PhpFieldsOnlyCtorAttribute,
                        ImmutableArray <TypedConstant> .Empty,
                        ImmutableArray <KeyValuePair <string, TypedConstant> > .Empty);
                }

                attrs = attrs.Add(_lazyPhpFieldsOnlyCtorAttribute);
            }

            return(attrs);
        }
Example #2
0
        public override ImmutableArray <AttributeData> GetAttributes()
        {
            var attrs = base.GetAttributes();

            if (this.IsTrait)
            {
                // [PhpTraitAttribute()]

                if (_lazyPhpTraitAttribute == null)
                {
                    _lazyPhpTraitAttribute = new SynthesizedAttributeData(
                        DeclaringCompilation.CoreMethods.Ctors.PhpTraitAttribute,
                        ImmutableArray <TypedConstant> .Empty,
                        ImmutableArray <KeyValuePair <string, TypedConstant> > .Empty);
                }

                attrs = attrs.Add(_lazyPhpTraitAttribute);
            }

            return(attrs);
        }
Example #3
0
        public override ImmutableArray<AttributeData> GetAttributes()
        {
            // [ScriptAttribute(RelativeFilePath)]  // TODO: LastWriteTime
            if (_lazyScriptAttribute == null)
            {
                _lazyScriptAttribute = new SynthesizedAttributeData(
                    DeclaringCompilation.CoreMethods.Ctors.ScriptAttribute_string,
                    ImmutableArray.Create(new TypedConstant(DeclaringCompilation.CoreTypes.String.Symbol, TypedConstantKind.Primitive, this.RelativeFilePath)),
                    ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty);
            }

            //
            return ImmutableArray.Create<AttributeData>(_lazyScriptAttribute);
        }