Skip to content

Commit edc6af8

Browse files
committed
Added missing variable declarations in UnhandledErrorsChecker
1 parent 2709ea7 commit edc6af8

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

go-lisa/src/main/java/it/unive/golisa/checker/hf/UnhandledErrorsChecker.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
import it.unive.golisa.cfg.statement.assignment.GoAssignment;
77
import it.unive.golisa.cfg.statement.assignment.GoMultiAssignment;
8+
import it.unive.golisa.cfg.statement.assignment.GoShortVariableDeclaration;
9+
import it.unive.golisa.cfg.statement.assignment.GoVariableDeclaration;
810
import it.unive.golisa.cfg.utils.CFGUtils;
911
import it.unive.golisa.checker.hf.readwrite.ReadWriteHFUtils;
1012
import it.unive.golisa.golang.util.GoLangUtils;
@@ -90,6 +92,36 @@ public boolean visit(CheckTool tool, CFG graph, Statement node) {
9092
}
9193
}
9294

95+
if (node instanceof GoShortVariableDeclaration) {
96+
GoShortVariableDeclaration declr = (GoShortVariableDeclaration) node;
97+
Expression right = declr.getRight();
98+
if (right instanceof Call) {
99+
if (ReadWriteHFUtils.isWriteCall((Call) right)) {
100+
assignmentMap.put((Call) right, Boolean.TRUE);
101+
Expression left = declr.getLeft();
102+
if (left instanceof VariableRef) {
103+
checkVariableRef((VariableRef) left, (Call) right, tool, graph, node);
104+
}
105+
}
106+
107+
}
108+
}
109+
110+
if (node instanceof GoVariableDeclaration) {
111+
GoVariableDeclaration declr = (GoVariableDeclaration) node;
112+
Expression right = declr.getRight();
113+
if (right instanceof Call) {
114+
if (ReadWriteHFUtils.isWriteCall((Call) right)) {
115+
assignmentMap.put((Call) right, Boolean.TRUE);
116+
Expression left = declr.getLeft();
117+
if (left instanceof VariableRef) {
118+
checkVariableRef((VariableRef) left, (Call) right, tool, graph, node);
119+
}
120+
}
121+
122+
}
123+
}
124+
93125
return true;
94126
}
95127

0 commit comments

Comments
 (0)