Creates a shallow copy of this variable scope with the same parent, class scope, static context, and copies of all variable maps. The returned scope is independent from the original and may be safely modified without affecting the source scope. @return a new VariableScope with copied config
()
| 301 | * @return a new {@link VariableScope} with copied configuration |
| 302 | */ |
| 303 | public VariableScope copy() { |
| 304 | VariableScope that = new VariableScope(parent); |
| 305 | that.classScope = this.classScope; |
| 306 | that.inStaticContext = this.inStaticContext; |
| 307 | if (!this.declaredVariables.isEmpty()) { |
| 308 | that.declaredVariables = new LinkedHashMap<>(this.declaredVariables); |
| 309 | } |
| 310 | if (!this.referencedLocalVariables.isEmpty()) { |
| 311 | that.referencedLocalVariables = new LinkedHashMap<>(this.referencedLocalVariables); |
| 312 | } |
| 313 | if (!this.referencedClassVariables.isEmpty()) { |
| 314 | that.referencedClassVariables = new LinkedHashMap<>(this.referencedClassVariables); |
| 315 | } |
| 316 | return that; |
| 317 | } |
| 318 | } |
no test coverage detected