Class to represent a synthesized attribute
Inheritance: SourceAttributeData
        public override ImmutableArray <AttributeData> GetAttributes()
        {
            // [PharAttribute(PharFile)]
            if (_lazyPharAttribute == null)
            {
                var pharAttribute = new SynthesizedAttributeData(
                    DeclaringCompilation.CoreMethods.Ctors.PharAttribute_string,
                    ImmutableArray.Create(new TypedConstant(DeclaringCompilation.CoreTypes.String.Symbol, TypedConstantKind.Primitive, PharName)),
                    ImmutableArray <KeyValuePair <string, TypedConstant> > .Empty);
                Interlocked.CompareExchange(ref _lazyPharAttribute, pharAttribute, null);
            }

            return(base.GetAttributes().Concat(_lazyPharAttribute));
        }
        public override ImmutableArray <AttributeData> GetAttributes()
        {
            // [ScriptAttribute(RelativeFilePath)]  // TODO: LastWriteTime
            if (_lazyScriptAttribute == null)
            {
                var scriptAttribute = new SynthesizedAttributeData(
                    DeclaringCompilation.CoreMethods.Ctors.ScriptAttribute_string,
                    ImmutableArray.Create(new TypedConstant(DeclaringCompilation.CoreTypes.String.Symbol, TypedConstantKind.Primitive, this.RelativeFilePath)),
                    ImmutableArray <KeyValuePair <string, TypedConstant> > .Empty);
                Interlocked.CompareExchange(ref _lazyScriptAttribute, scriptAttribute, null);
            }

            //
            return(ImmutableArray.Create <AttributeData>(_lazyScriptAttribute));
        }
Esempio n. 3
0
        public override ImmutableArray <AttributeData> GetAttributes()
        {
            var attrs = base.GetAttributes();

            // [PhpTraitAttribute()]
            if (_lazyPhpTraitAttribute == null)
            {
                var lazyPhpTraitAttribute = new SynthesizedAttributeData(
                    DeclaringCompilation.CoreMethods.Ctors.PhpTraitAttribute,
                    ImmutableArray <TypedConstant> .Empty,
                    ImmutableArray <KeyValuePair <string, TypedConstant> > .Empty);
                Interlocked.CompareExchange(ref _lazyPhpTraitAttribute, lazyPhpTraitAttribute, null);
            }

            attrs = attrs.Add(_lazyPhpTraitAttribute);

            //
            return(attrs);
        }