MCPcopy Create free account
hub / github.com/mozilla/rhino / replaceWith

Method replaceWith

rhino/src/main/java/org/mozilla/javascript/ast/Scope.java:89–100  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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() {

Callers 1

forLoopMethod · 0.45

Calls 4

joinScopesMethod · 0.95
addChildScopeMethod · 0.80
isEmptyMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected