private void CheckStructs()
 {
     lock (this.SyncObject)
         if (this.structs == null)
         {
             if (this.IsDisposed)
             {
                 throw new InvalidOperationException(Resources.ObjectStateThrowMessage);
             }
             this.structs = this.InitializeStructs();
             SuspendCheck(this.SyncObject, this.structs, this.suspendLevel);
         }
 }
 /// <summary>
 /// Frees managed resources used by the
 /// <see cref="IntermediateGenericSegmentableParentType{TTypeIdentifier, TType, TIntermediateType, TInstanceIntermediateType}"/>.
 /// </summary>
 public override void Dispose()
 {
     try
     {
         if (this.classes != null)
         {
             this.classes.Dispose();
             this.classes = null;
         }
         if (this.enums != null)
         {
             this.enums.Dispose();
             this.enums = null;
         }
         if (this.delegates != null)
         {
             this.delegates.Dispose();
             this.delegates = null;
         }
         if (this.interfaces != null)
         {
             this.interfaces.Dispose();
             this.interfaces = null;
         }
         if (this.structs != null)
         {
             this.structs.Dispose();
             this.structs = null;
         }
         if (this.types != null)
         {
             if (this.IsRoot)
             {
                 this.types.Dispose();
             }
             else
             {
                 this.types.ConditionalRemove(this);
             }
             this.types = null;
         }
         if (this.scopeCoercions != null)
         {
             this.scopeCoercions = null;
         }
     }
     finally
     {
         base.Dispose();
     }
 }
        /// <summary>
        /// Initializes the <see cref="Structs"/> property.
        /// </summary>
        /// <returns>A new <see cref="IntermediateStructTypeDictionary"/> instance</returns>
        /// <remarks>If <see cref="IntermediateGenericSegmentableType{TTypeIdentifier, TType, TIntermediateType, TInstanceIntermediateType}.IsRoot"/>
        /// is true, this creates a new standalone struct type dictionary linked to the master
        /// <see cref="Types"/> dictionary; however, if false, it creates a dependent
        /// struct type dictionary which mirrors the members of the root declaration and all other
        /// partial instances.  Parent target discernment is provided by the
        /// <see cref="IntermediateTypeDictionary{TTypeIdentifier, TType, TIntermediateType}.Parent"/>
        /// of the dictionary for the current instance.  Add methods called upon the
        /// instance provided here report the current partial instance as the parent.</remarks>
        protected virtual IntermediateStructTypeDictionary InitializeStructs()
        {
            IntermediateStructTypeDictionary result;

            if (this.IsRoot)
            {
                result = new IntermediateStructTypeDictionary(this, this._Types);
            }
            else
            {
                result = new IntermediateStructTypeDictionary(this, this._Types, (IntermediateStructTypeDictionary)this.GetRoot().Structs);
            }
            if (this.IsLocked)
            {
                result.Lock();
            }
            return(result);
        }
Beispiel #4
0
 /// <summary>
 /// Disposes the <see cref="IntermediateNamespaceDeclaration"/>
 /// </summary>
 /// <param name="disposing">whether to dispose the managed
 /// resources as well as the unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             lock (this.SyncObject)
             {
                 this.parent = null;
                 if (this.methods != null)
                 {
                     this.methods.Dispose();
                     this.methods = null;
                 }
                 if (this.fields != null)
                 {
                     this.fields.Dispose();
                     this.fields = null;
                 }
                 if (this.members != null)
                 {
                     if (this.IsRoot)
                     {
                         this.members.Dispose();
                     }
                     else
                     {
                         this.members.ConditionalRemove(this);
                     }
                     this.members = null;
                 }
                 if (this.classes != null)
                 {
                     this.classes.Dispose();
                     this.classes = null;
                 }
                 if (this.enums != null)
                 {
                     this.enums.Dispose();
                     this.enums = null;
                 }
                 if (this.delegates != null)
                 {
                     this.delegates.Dispose();
                     this.delegates = null;
                 }
                 if (this.interfaces != null)
                 {
                     this.interfaces.Dispose();
                     this.interfaces = null;
                 }
                 if (this.structs != null)
                 {
                     this.structs.Dispose();
                     this.structs = null;
                 }
                 if (this.types != null)
                 {
                     if (this.IsRoot)
                     {
                         this.types.Dispose();
                     }
                     else
                     {
                         this.types.ConditionalRemove(this);
                     }
                     this.types = null;
                 }
                 if (this.namespaces != null)
                 {
                     this.namespaces.Dispose();
                     this.namespaces = null;
                 }
                 this.scopeCoercions = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
 /// <summary>
 /// Creates a new <see cref="IntermediateStructTypeDictionary"/> with the
 /// <paramref name="parent"/>, <paramref name="master"/>, and <paramref name="root"/>
 /// provided.
 /// </summary>
 /// <param name="parent">The <see cref="IIntermediateTypeParent"/> which contains the
 /// <see cref="IntermediateStructTypeDictionary"/></param>
 /// <param name="master">The <see cref="IntermediateFullTypeDictionary"/>
 /// which maintains a verbatim-order set of kind-inspecific types.</param>
 /// <param name="root">The <see cref="IntermediateStructTypeDictionary"/>
 /// which is synchronized with the current instance to enable varied parents
 /// across a single set of structure declarations; used for partial types.</param>
 /// <exception cref="System.ArgumentNullException">thrown when one or more of <paramref name="parent"/>,
 /// <paramref name="master"/> or <paramref name="root"/> is null.</exception>
 public IntermediateStructTypeDictionary(IIntermediateTypeParent parent, IntermediateFullTypeDictionary master, IntermediateStructTypeDictionary root)
     : base(parent, master, root)
 {
 }