|
9 | 9 |
|
10 | 10 | private import codeql.controlflow.ControlFlowGraph as CfgLib |
11 | 11 | private import codeql.controlflow.SuccessorType |
| 12 | +private import codeql.util.Void |
12 | 13 |
|
13 | 14 | /** Contains the shared CFG library instantiation for Go. */ |
14 | 15 | module GoCfg { |
@@ -72,6 +73,14 @@ module GoCfg { |
72 | 73 |
|
73 | 74 | AstNode callableGetBody(Callable c) { result = c } |
74 | 75 |
|
| 76 | + class Parameter extends AstNode { |
| 77 | + Parameter() { none() } |
| 78 | + |
| 79 | + Expr getDefaultValue() { none() } |
| 80 | + } |
| 81 | + |
| 82 | + Parameter callableGetParameter(Callable c, int index) { none() } |
| 83 | + |
75 | 84 | Callable getEnclosingCallable(AstNode node) { |
76 | 85 | result = node and node instanceof Callable |
77 | 86 | or |
@@ -152,12 +161,14 @@ module GoCfg { |
152 | 161 |
|
153 | 162 | class ContinueStmt = Go::ContinueStmt; |
154 | 163 |
|
| 164 | + class GotoStmt = Go::GotoStmt; |
| 165 | + |
155 | 166 | class ReturnStmt extends Go::ReturnStmt { |
156 | 167 | override Expr getExpr() { result = Go::ReturnStmt.super.getExpr() } |
157 | 168 | } |
158 | 169 |
|
159 | | - class ThrowStmt extends Stmt { |
160 | | - ThrowStmt() { none() } |
| 170 | + class Throw extends AstNode { |
| 171 | + Throw() { none() } |
161 | 172 |
|
162 | 173 | Expr getExpr() { none() } |
163 | 174 | } |
@@ -241,12 +252,46 @@ module GoCfg { |
241 | 252 |
|
242 | 253 | boolean getValue() { result = val } |
243 | 254 | } |
| 255 | + |
| 256 | + class Assignment extends BinaryExpr { |
| 257 | + Assignment() { none() } |
| 258 | + } |
| 259 | + |
| 260 | + class AssignExpr extends Assignment { |
| 261 | + AssignExpr() { none() } |
| 262 | + } |
| 263 | + |
| 264 | + class CompoundAssignment extends Assignment { |
| 265 | + CompoundAssignment() { none() } |
| 266 | + } |
| 267 | + |
| 268 | + class AssignLogicalAndExpr extends CompoundAssignment { |
| 269 | + AssignLogicalAndExpr() { none() } |
| 270 | + } |
| 271 | + |
| 272 | + class AssignLogicalOrExpr extends CompoundAssignment { |
| 273 | + AssignLogicalOrExpr() { none() } |
| 274 | + } |
| 275 | + |
| 276 | + class AssignNullCoalescingExpr extends CompoundAssignment { |
| 277 | + AssignNullCoalescingExpr() { none() } |
| 278 | + } |
| 279 | + |
| 280 | + class PatternMatchExpr extends Expr { |
| 281 | + PatternMatchExpr() { none() } |
| 282 | + |
| 283 | + Expr getExpr() { none() } |
| 284 | + |
| 285 | + AstNode getPattern() { none() } |
| 286 | + } |
244 | 287 | } |
245 | 288 |
|
246 | 289 | /** The Input module implementing InputSig1 and InputSig2 for Go. */ |
247 | 290 | private module Input implements Cfg0::InputSig1, Cfg1::InputSig2 { |
248 | 291 | predicate cfgCachedStageRef() { CfgCachedStage::ref() } |
249 | 292 |
|
| 293 | + class CallableContext = Void; |
| 294 | + |
250 | 295 | private newtype TLabel = |
251 | 296 | TGoLabel(string l) { exists(Go::LabeledStmt ls | l = ls.getLabel()) } or |
252 | 297 | TFallthrough() |
|
0 commit comments