aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/language/src/main/java/tools/refinery/language/resource/state/ImplicitVariableScope.java
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/language/src/main/java/tools/refinery/language/resource/state/ImplicitVariableScope.java')
-rw-r--r--subprojects/language/src/main/java/tools/refinery/language/resource/state/ImplicitVariableScope.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/state/ImplicitVariableScope.java b/subprojects/language/src/main/java/tools/refinery/language/resource/state/ImplicitVariableScope.java
index e25887ad..c8e01724 100644
--- a/subprojects/language/src/main/java/tools/refinery/language/resource/state/ImplicitVariableScope.java
+++ b/subprojects/language/src/main/java/tools/refinery/language/resource/state/ImplicitVariableScope.java
@@ -1,5 +1,5 @@
1/* 1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> 2 * SPDX-FileCopyrightText: 2021-2024 The Refinery Authors <https://refinery.tools/>
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
@@ -16,10 +16,7 @@ import org.eclipse.xtext.scoping.IScopeProvider;
16import tools.refinery.language.model.problem.*; 16import tools.refinery.language.model.problem.*;
17import tools.refinery.language.naming.NamingUtil; 17import tools.refinery.language.naming.NamingUtil;
18 18
19import java.util.Deque; 19import java.util.*;
20import java.util.HashSet;
21import java.util.List;
22import java.util.Set;
23 20
24public class ImplicitVariableScope { 21public class ImplicitVariableScope {
25 private final EObject root; 22 private final EObject root;
@@ -71,13 +68,12 @@ public class ImplicitVariableScope {
71 if ((hasKnownVariables && hasParent) || (!hasKnownVariables && !hasParent)) { 68 if ((hasKnownVariables && hasParent) || (!hasKnownVariables && !hasParent)) {
72 throw new IllegalStateException("Either known variables or parent must be provided, but not both"); 69 throw new IllegalStateException("Either known variables or parent must be provided, but not both");
73 } 70 }
74 if (hasKnownVariables) { 71 if (!hasKnownVariables) {
75 return; 72 if (parent.knownVariables == null) {
76 } 73 throw new IllegalStateException("Parent scope must be processed before current scope");
77 if (parent.knownVariables == null) { 74 }
78 throw new IllegalStateException("Parent scope must be processed before current scope"); 75 knownVariables = new HashSet<>(parent.knownVariables);
79 } 76 }
80 knownVariables = new HashSet<>(parent.knownVariables);
81 } 77 }
82 78
83 private void processEObject(EObject eObject, IScopeProvider scopeProvider, LinkingHelper linkingHelper, 79 private void processEObject(EObject eObject, IScopeProvider scopeProvider, LinkingHelper linkingHelper,