コード例 #1
0
        public override ImmutableArray <AttributeData> GetAttributes()
        {
            // [PharAttribute(PharFile)]
            if (_lazyPharAttribute == null)
            {
                var pharAttribute = new SynthesizedAttributeData(
                    DeclaringCompilation.CoreMethods.Ctors.PharAttribute_string,
                    ImmutableArray.Create(DeclaringCompilation.CreateTypedConstant(PharName)),
                    ImmutableArray <KeyValuePair <string, TypedConstant> > .Empty);
                Interlocked.CompareExchange(ref _lazyPharAttribute, pharAttribute, null);
            }

            return(base.GetAttributes().Concat(_lazyPharAttribute));
        }
コード例 #2
0
        public override ImmutableArray <AttributeData> GetAttributes()
        {
            // [ScriptAttribute(RelativeFilePath)]  // TODO: LastWriteTime
            if (_lazyScriptAttribute == null)
            {
                var scriptAttribute = new SynthesizedAttributeData(
                    DeclaringCompilation.CoreMethods.Ctors.ScriptAttribute_string,
                    ImmutableArray.Create(DeclaringCompilation.CreateTypedConstant(this.RelativeFilePath)),
                    ImmutableArray <KeyValuePair <string, TypedConstant> > .Empty);
                Interlocked.CompareExchange(ref _lazyScriptAttribute, scriptAttribute, null);
            }

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