// Dump the scope to an xml file public void Dump(XmlWriter o, bool fRecursive) { o.WriteStartElement("scope"); o.WriteAttributeString("name", m_szDebugName); ILookupController p = this.m_pController; o.WriteAttributeString("controller", (p == null) ? "none" : ((object)p).GetType().Name); /* * if (m_SuperScope != null) * { * o.WriteAttributeString("super", m_SuperScope.m_szDebugName); * } */ System.Collections.IDictionaryEnumerator e = m_table.GetEnumerator(); while (e.MoveNext()) { string str = (string)e.Key; SymEntry sym = (SymEntry)e.Value; sym.Dump(o, fRecursive); } o.WriteEndElement(); // scope }
/// <summary> /// Create a scope that has its own controller and lexical parent, but shares /// a set of symbols with an existing scope. /// </summary> /// <remark> /// We may want multiple Scopes with different controllers but that share /// the same symbol set. /// <para>Ex: A namespace can be declared in multiple blocks. All sections reside /// in the same scope. However, each block has its own set of using /// directives. So we want multiple scopes that share the same set of symbols, /// but each scope needs its own controller to handle its own set of using directives</para> /// </remark> /// <param name="pController">The controller for the new scope</param> /// <param name="scopeLexicalParent"></param> /// <returns>A new scope with the specified lexical parent and owned by the given /// controller, but sharing the same set of symbols as the current scope.</returns> public Scope CreateSharedScope(ILookupController pController, Scope scopeLexicalParent) { Scope s = new Scope(); s.m_szDebugName = m_szDebugName; s.m_pController = pController; s.m_LexicalParent = scopeLexicalParent; // Both scopes share the same table. s.m_table = m_table; return(s); }
/// <summary> /// Create a Scope object /// <seealso cref="CreateSharedScope"/> /// </summary> /// <param name="szDebugName">A string name to identify the scope for debugging uses.</param> /// <param name="pController">An ILookupController to allow the scope to do smart lookups. (can be null)</param> /// <param name="scopeLexicalParent">The lexical parent of the scope. (may be null). </param> public Scope(string szDebugName, ILookupController pController, Scope scopeLexicalParent) : this() { #if false if (szDebugName == "cClass_") { System.Diagnostics.Debugger.Break(); } #endif m_szDebugName = szDebugName; m_pController = pController; m_LexicalParent = scopeLexicalParent; m_table = new System.Collections.Hashtable(); }
/// <summary> /// Create a scope that has its own controller and lexical parent, but shares /// a set of symbols with an existing scope. /// </summary> /// <remark> /// We may want multiple Scopes with different controllers but that share /// the same symbol set. /// <para>Ex: A namespace can be declared in multiple blocks. All sections reside /// in the same scope. However, each block has its own set of using /// directives. So we want multiple scopes that share the same set of symbols, /// but each scope needs its own controller to handle its own set of using directives</para> /// </remark> /// <param name="pController">The controller for the new scope</param> /// <param name="scopeLexicalParent"></param> /// <returns>A new scope with the specified lexical parent and owned by the given /// controller, but sharing the same set of symbols as the current scope.</returns> public Scope CreateSharedScope(ILookupController pController, Scope scopeLexicalParent) { Scope s = new Scope(); s.m_szDebugName = m_szDebugName; s.m_pController = pController; s.m_LexicalParent = scopeLexicalParent; // Both scopes share the same table. s.m_table = m_table; return s; }
/// <summary> /// Create a Scope object /// <seealso cref="CreateSharedScope"/> /// </summary> /// <param name="szDebugName">A string name to identify the scope for debugging uses.</param> /// <param name="pController">An ILookupController to allow the scope to do smart lookups. (can be null)</param> /// <param name="scopeLexicalParent">The lexical parent of the scope. (may be null). </param> public Scope(string szDebugName, ILookupController pController, Scope scopeLexicalParent) : this() { #if false if (szDebugName == "cClass_") System.Diagnostics.Debugger.Break(); #endif m_szDebugName = szDebugName; m_pController = pController; m_LexicalParent = scopeLexicalParent; m_table = new System.Collections.Hashtable(); }