|
5 | 5 |
|
6 | 6 | import it.unive.golisa.cfg.statement.assignment.GoAssignment; |
7 | 7 | 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; |
8 | 10 | import it.unive.golisa.cfg.utils.CFGUtils; |
9 | 11 | import it.unive.golisa.checker.hf.readwrite.ReadWriteHFUtils; |
10 | 12 | import it.unive.golisa.golang.util.GoLangUtils; |
@@ -90,6 +92,36 @@ public boolean visit(CheckTool tool, CFG graph, Statement node) { |
90 | 92 | } |
91 | 93 | } |
92 | 94 |
|
| 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 | + |
93 | 125 | return true; |
94 | 126 | } |
95 | 127 |
|
|
0 commit comments