/// <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; }