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. @param newScope the scope that will replace this one on the scope stack.
(Scope newScope)
| 87 | * @param newScope the scope that will replace this one on the scope stack. |
| 88 | */ |
| 89 | public void replaceWith(Scope newScope) { |
| 90 | if (childScopes != null) { |
| 91 | for (Scope kid : childScopes) { |
| 92 | newScope.addChildScope(kid); // sets kid's parent |
| 93 | } |
| 94 | childScopes.clear(); |
| 95 | childScopes = null; |
| 96 | } |
| 97 | if (symbolTable != null && !symbolTable.isEmpty()) { |
| 98 | joinScopes(this, newScope); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | /** Returns current script or function scope */ |
| 103 | public ScriptNode getTop() { |
no test coverage detected