Skip to content
Snippets Groups Projects
Commit 674247d7 authored by Jan Gruteser's avatar Jan Gruteser
Browse files

use one util method for declaration map

parent b26ab680
No related branches found
No related tags found
No related merge requests found
......@@ -147,12 +147,10 @@ public class SpecAnalyser extends BuiltInOPs {
}
findRecursiveConstructs();
for (OpDeclNode var : moduleNode.getVariableDecls()) {
namingMap.put(var.getName().toString(), var);
}
namingMap.putAll(TlaUtils.getDeclarationsMap(moduleNode.getVariableDecls()));
DebugUtils.printMsg("Number of variables detected: " + moduleNode.getVariableDecls().length);
namingMap.putAll(TlaUtils.getConstantsMap(moduleNode.getConstantDecls()));
namingMap.putAll(TlaUtils.getDeclarationsMap(moduleNode.getConstantDecls()));
DebugUtils.printMsg("Number of constants detected: " + moduleNode.getConstantDecls().length);
namingMap.putAll(TlaUtils.getOpDefsMap(usedDefinitions.toArray(new OpDefNode[0])));
......
......@@ -58,7 +58,7 @@ public class ConfigfileEvaluator {
this.configAst = configAst;
this.moduleNode = moduleNode;
this.definitions = TlaUtils.getOpDefsMap(moduleNode.getOpDefs());
this.constants = TlaUtils.getConstantsMap(moduleNode.getConstantDecls());
this.constants = TlaUtils.getDeclarationsMap(moduleNode.getConstantDecls());
this.bConstantList.addAll(constants.values());
this.nextNode = evalPredicate(configAst.getNext(), "next state"); // check if NEXT declaration is a valid definition
......
......@@ -8,12 +8,12 @@ import java.util.Map;
public class TlaUtils {
public static Map<String, OpDeclNode> getConstantsMap(OpDeclNode[] constantNodes) {
Map<String, OpDeclNode> constants = new HashMap<>();
for (OpDeclNode con : constantNodes) {
constants.put(con.getName().toString(), con);
public static Map<String, OpDeclNode> getDeclarationsMap(OpDeclNode[] declNodes) {
Map<String, OpDeclNode> decl = new HashMap<>();
for (OpDeclNode con : declNodes) {
decl.put(con.getName().toString(), con);
}
return constants;
return decl;
}
public static Map<String, OpDefNode> getOpDefsMap(OpDefNode[] opDefNodes) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment