Rhino.Ast.Scope.SetParentScope C# (CSharp) Method

SetParentScope() public method

Sets parent scope
public SetParentScope ( Rhino parentScope ) : void
parentScope Rhino
return void
		public virtual void SetParentScope(Rhino.Ast.Scope parentScope)
		{
			this.parentScope = parentScope;
			this.top = parentScope == null ? (ScriptNode)this : parentScope.top;
		}

Usage Example

Ejemplo n.º 1
0
		/// <summary>
		/// Creates a new scope node, moving symbol table information
		/// from "scope" to the new node, and making "scope" a nested
		/// scope contained by the new node.
		/// </summary>
		/// <remarks>
		/// Creates a new scope node, moving symbol table information
		/// from "scope" to the new node, and making "scope" a nested
		/// scope contained by the new node.
		/// Useful for injecting a new scope in a scope chain.
		/// </remarks>
		public static Rhino.Ast.Scope SplitScope(Rhino.Ast.Scope scope)
		{
			Rhino.Ast.Scope result = new Rhino.Ast.Scope(scope.GetType());
			result.symbolTable = scope.symbolTable;
			scope.symbolTable = null;
			result.parent = scope.parent;
			result.SetParentScope(scope.GetParentScope());
			result.SetParentScope(result);
			scope.parent = result;
			result.top = scope.top;
			return result;
		}