-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStmts.qll
More file actions
173 lines (141 loc) · 5.79 KB
/
Stmts.qll
File metadata and controls
173 lines (141 loc) · 5.79 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/**
* Statement nodes in the AST.
*/
private import AstNodes
private import Idents
private import Expr
private import Misc
private import internal.AstNodes
private import internal.TreeSitter
private import internal.Stmts
private import internal.AssertStatement
private import internal.ForStatement
private import internal.IfStatement
private import internal.ImportStatement
private import internal.ImportWithStatement
private import internal.Infrastructure
private import internal.Statement
private import internal.UsingStatement
private import internal.Parameter
private import internal.Parameters
private import internal.ParameterDeclaration
private import internal.OutputDeclaration
private import internal.UserDefinedFunction
// CFG
private import codeql.bicep.CFG
private import codeql.bicep.controlflow.internal.ControlFlowGraphImpl as CfgImpl
/**
* A Stmt block
*/
class Stmts extends AstNode instanceof StmtsImpl {
/** Gets a control-flow node for this statement, if any. */
CfgImpl::AstCfgNode getAControlFlowNode() { result.getAstNode() = this }
/** Gets a control-flow entry node for this statement, if any */
AstNode getAControlFlowEntryNode() { result = CfgImpl::getAControlFlowEntryNode(this) }
}
/**
* A AssertStatement statement
*/
final class AssertStatementStmt extends Stmts instanceof AssertStatementImpl { }
/**
* A ForStatement statement
*/
final class ForStatementStmt extends Stmts instanceof ForStatementImpl { }
/**
* A IfStatement statement
*/
class IfStatement extends Stmts instanceof IfStatementImpl {
/** Gets the condition of the if statement. */
Expr getCondition() { result = IfStatementImpl.super.getCondition() }
/** Gets the body of the if statement. */
Expr getBody() { result = IfStatementImpl.super.getBody() }
}
/**
* A ImportStatement statement
*/
final class ImportStatementStmt extends Stmts instanceof ImportStatementImpl { }
/**
* A Infrastructure unknown AST node.
*/
class Infrastructure extends AstNode instanceof InfrastructureImpl {
/** Gets the first statement in the infrastructure. */
Stmts getStatement(int index) { result = InfrastructureImpl.super.getStatement(index) }
}
/**
* Represents a parameter declaration node in the AST.
* Provides access to the identifier, name, type, and default value of the parameter.
*/
class ParameterDeclaration extends AstNode instanceof ParameterDeclarationImpl {
/** Gets the identifier of the parameter declaration. */
Identifier getIdentifier() { result = ParameterDeclarationImpl.super.getName() }
/** Gets the name of the parameter declaration. */
string getName() { result = this.getIdentifier().getName() }
/** Gets the type of the parameter declaration. */
Type getType() { result = ParameterDeclarationImpl.super.getType() }
/** Gets the default value of the parameter declaration, if any. */
Expr getDefaultValue() { result = ParameterDeclarationImpl.super.getDefaultValue() }
}
/**
* Represents an output declaration node in the AST.
* Provides access to the identifier, name, type, and value of the output.
*/
class OutputDeclaration extends AstNode instanceof OutputDeclarationImpl {
/** Gets the identifier of the output declaration. */
Identifier getIdentifier() { result = OutputDeclarationImpl.super.getIdentifier() }
/** Gets the name of the output declaration. */
string getName() { result = this.getIdentifier().getName() }
/** Gets the type of the output declaration. */
Type getType() { result = OutputDeclarationImpl.super.getType() }
/** Gets the value of the output declaration. */
Expr getValue() { result = OutputDeclarationImpl.super.getValue() }
}
/**
* Represents a user-defined function node in the AST.
* Provides access to the identifier, name, return type, parameters, and body of the function.
*/
class UserDefinedFunction extends AstNode instanceof UserDefinedFunctionImpl {
/** Gets the identifier of the user-defined function. */
Identifier getIdentifier() { result = UserDefinedFunctionImpl.super.getName() }
/** Gets the name of the user-defined function. */
string getName() { result = this.getIdentifier().getName() }
/** Gets the return type of the user-defined function. */
Type getReturnType() { result = UserDefinedFunctionImpl.super.getReturnType() }
/** Gets the declared parameters of the user-defined function. */
Parameters getDeclaredParameters() { result = UserDefinedFunctionImpl.super.getParameters() }
/** Gets all parameters of the user-defined function. */
Parameter getParameters() { result = this.getDeclaredParameters().getParameter(_) }
/** Gets the parameter at the specified index. */
Parameter getParameter(int index) { result = this.getDeclaredParameters().getParameter(index) }
/** Gets the body of the user-defined function. */
Expr getBody() { result = UserDefinedFunctionImpl.super.getBody() }
}
/**
* Represents a parameter node in the AST.
* Provides access to the parameter's name and type.
*/
class Parameter extends AstNode instanceof ParameterImpl {
/** Gets the name of the parameter. */
Idents getName() { result = ParameterImpl.super.getName() }
/** Gets the type of the parameter. */
Type getType() { result = ParameterImpl.super.getType() }
}
/**
* Represents a parameters node in the AST.
* Provides access to individual parameters by index.
*/
class Parameters extends AstNode instanceof ParametersImpl {
/** Gets the parameter at the specified index. */
Parameter getParameter(int index) { result = ParametersImpl.super.getParameter(index) }
}
/**
* A ImportWithStatement statement
*/
final class ImportWithStatementStmt extends Stmts instanceof ImportWithStatementImpl { }
/**
* A Statement statement
*/
final class StatementStmt extends Stmts instanceof StatementImpl { }
/**
* A UsingStatement statement
*/
final class UsingStatementStmt extends Stmts instanceof UsingStatementImpl { }