remove doipOperationMap in ContractNode

This commit is contained in:
haoeliu@foxmail.com 2022-11-16 14:57:29 +08:00
parent 5fd1c684aa
commit 07c8f40059

View File

@ -13,7 +13,6 @@ public class ContractNode {
private final List<ClassNode> clzs;
private final List<FunctionNode> functions;
private final Map<String, FunctionNode> functionMap;
private final Map<BasicOperations, FunctionNode> doipOperationsMap;
private final Set<String> dependentContracts;
public Map<String, REventSemantics> events;
public Map<String, REventSemantics> logs;
@ -40,7 +39,6 @@ public class ContractNode {
permission = new ArrayList<>();
instrumentBranch = false;
dependentContracts = new HashSet<>();
doipOperationsMap = new HashMap<>();
}
public void addFunction(FunctionNode function) {
@ -48,6 +46,12 @@ public class ContractNode {
getFunctions().add(function);
}
public void updateFunctionMap(String oldFunctionName, String newFunctionName) {
FunctionNode fn = functionMap.get(oldFunctionName);
functionMap.remove(oldFunctionName);
functionMap.put(newFunctionName, fn);
}
public void addClass(ClassNode clzNode) {
getClzs().add(clzNode);
}
@ -199,25 +203,4 @@ public class ContractNode {
public void resetContractName(String name) {
contractName = name;
}
public void addDoipOperation(FunctionNode function) {
doipOperationsMap.put(function.getDoipOperationInfo().operationType, function);
}
public FunctionNode getDoipOperation(String action) {
FunctionNode result = null;
for (BasicOperations op : BasicOperations.values()) {
if (op.toString().equals(action)) {
result = doipOperationsMap.get(op);
return result;
}
}
result = doipOperationsMap.get(BasicOperations.Unknown);
return result;
}
public FunctionNode getDoipOperation(BasicOperations basicOperation) {
return doipOperationsMap.get(basicOperation);
}
}