/// <summary>
        /// Returns null if there are no compiler generated fields.
        /// </summary>
        public IEnumerable <Cci.IFieldDefinition> GetCompilerGeneratedFields(TNamedTypeSymbol container)
        {
            CompilerGeneratedDefinitions defs = GetCacheOfCompilerGeneratedDefinitions(container, addIfNotFound: false);

            if (defs != null)
            {
                return(defs.Fields);
            }

            return(null);
        }
        public void AddCompilerGeneratedDefinition(TNamedTypeSymbol container, Cci.IPropertyDefinition property)
        {
            Debug.Assert(property != null);

            CompilerGeneratedDefinitions defs = GetCacheOfCompilerGeneratedDefinitions(container);

            if (defs.Properties == null)
            {
                Interlocked.CompareExchange(ref defs.Properties, new ConcurrentQueue <Cci.IPropertyDefinition>(), null);
            }

            defs.Properties.Enqueue(property);
        }
        public void AddCompilerGeneratedDefinition(TNamedTypeSymbol container, Cci.IFieldDefinition field)
        {
            Debug.Assert(field != null);

            CompilerGeneratedDefinitions defs = GetCacheOfCompilerGeneratedDefinitions(container);

            if (defs.Fields == null)
            {
                Interlocked.CompareExchange(ref defs.Fields, new ConcurrentQueue <Cci.IFieldDefinition>(), null);
            }

            defs.Fields.Enqueue(field);
        }
        /// <summary>
        /// Returns null if there are no compiler generated types.
        /// </summary>
        public IEnumerable <Cci.INestedTypeDefinition> GetCompilerGeneratedTypes(TNamedTypeSymbol container)
        {
            IEnumerable <Cci.INestedTypeDefinition> declareTypes     = GetSynthesizedNestedTypes(container);
            IEnumerable <Cci.INestedTypeDefinition> compileEmitTypes = null;

            CompilerGeneratedDefinitions defs = GetCacheOfCompilerGeneratedDefinitions(container, addIfNotFound: false);

            if (defs != null)
            {
                compileEmitTypes = defs.NestedTypes;
            }

            if (declareTypes != null)
            {
                if (compileEmitTypes != null)
                {
                    return(System.Linq.Enumerable.Concat(declareTypes, compileEmitTypes));
                }

                return(declareTypes);
            }

            return(compileEmitTypes);
        }