Example #1
0
		/// <summary>Used by the parser; not intended for typical use.</summary>
		/// <remarks>
		/// Used by the parser; not intended for typical use.
		/// Changes the parent-scope links for this scope's child scopes
		/// to the specified new scope.  Copies symbols from this scope
		/// into new scope.
		/// </remarks>
		/// <param name="newScope">
		/// the scope that will replace this one on the
		/// scope stack.
		/// </param>
		public virtual void ReplaceWith(Rhino.Ast.Scope newScope)
		{
			if (childScopes != null)
			{
				foreach (Rhino.Ast.Scope kid in childScopes)
				{
					newScope.AddChildScope(kid);
				}
				// sets kid's parent
				childScopes.Clear();
				childScopes = null;
			}
			if (symbolTable != null && !symbolTable.IsEmpty())
			{
				JoinScopes(this, newScope);
			}
		}