-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConditionals.qll
More file actions
58 lines (51 loc) · 1.82 KB
/
Conditionals.qll
File metadata and controls
58 lines (51 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Loop statements are not supported in `bicep` code.
*/
private import Expr
private import Stmts
private import internal.Conditionals
private import internal.IfStatement
class Conditionals extends Stmts instanceof ConditionalsImpl {
/**
* Gets the condition expression of this conditional statement, if any.
*
* For if/elseif statements, this is the boolean expression in parentheses.
* For switch statements, this is the expression being switched on.
* For else clauses and default cases, this returns no result as they have no condition.
*/
Expr getCondition() { result = ConditionalsImpl.super.getCondition() }
/**
* Gets the branch (statement sequence) executed when this conditional is satisfied.
*
* This represents the code that runs when the condition is true or when
* this branch is selected in a switch/match statement.
*/
StmtSequence getBranch() { result = ConditionalsImpl.super.getBranch() }
}
/**
* An if statement in the AST.
*
* Represents a conditional statement in Bicep that executes certain code
* only when a specific condition is true. If statements enable conditional
* resource creation or property setting based on input parameters or other factors.
*/
class IfStatement extends Stmts instanceof IfStatementImpl {
/**
* Gets the condition of the if statement.
*
* This is the expression that is evaluated to determine whether
* the body of the if statement should be executed.
*
* @return The condition expression
*/
Expr getCondition() { result = IfStatementImpl.super.getCondition() }
/**
* Gets the body of the if statement.
*
* This is the expression or block that will be executed if the
* condition evaluates to true.
*
* @return The body expression
*/
Expr getBody() { result = IfStatementImpl.super.getBody() }
}