Skip to content

Commit 0a1c593

Browse files
committed
docs: Add documentation for Calls
1 parent 4ccdaad commit 0a1c593

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

ql/lib/codeql/bicep/ast/Calls.qll

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ private import internal.ParameterDeclaration
1010
private import internal.OutputDeclaration
1111
private import internal.UserDefinedFunction
1212

13+
/**
14+
* Represents a callable expression in the AST, such as a function or method call.
15+
* Provides access to the identifier and name of the call expression.
16+
*/
1317
abstract class Callable extends Expr {
1418
/**
1519
* Gets the identifier of the call expression.
@@ -18,96 +22,133 @@ abstract class Callable extends Expr {
1822

1923
/**
2024
* Gets the name of the call expression.
25+
*
26+
* @return The name as a string.
2127
*/
2228
string getName() { result = this.getIdentifier().getName() }
2329

2430
/**
2531
* Checks if the call expression has a specific name.
32+
*
33+
* @param name The name to check against.
34+
* @return True if the call expression has the given name.
2635
*/
2736
predicate hasName(string name) { this.getName() = name }
2837
}
2938

3039
/**
31-
* A CallExpression expression in the AST.
40+
* Represents a call expression node in the AST.
41+
* Provides access to the identifier, arguments, and declared arguments.
3242
*/
3343
class CallExpression extends Expr instanceof CallExpressionImpl {
44+
/** Gets the identifier of the call expression. */
3445
Idents getIdentifier() { result = CallExpressionImpl.super.getIdentifier() }
3546

47+
/** Gets the name of the call expression. */
3648
string getName() { result = this.getIdentifier().getName() }
3749

50+
/** Gets the argument at the specified index. */
3851
Expr getArgument(int index) { result = this.getDeclaredArguments().getArgument(index) }
3952

53+
/** Gets all arguments of the call expression. */
4054
Expr getArguments() { result = this.getDeclaredArguments().getArguments() }
4155

56+
/** Gets the declared arguments node. */
4257
Arguments getDeclaredArguments() { result = CallExpressionImpl.super.getArguments() }
4358
}
4459

4560
/**
46-
* A Arguments unknown AST node.
61+
* Represents the arguments node in the AST.
62+
* Provides access to individual and all arguments.
4763
*/
4864
class Arguments extends AstNode instanceof ArgumentsImpl {
65+
/** Gets the argument at the specified index. */
4966
Expr getArgument(int index) { result = ArgumentsImpl.super.getArgument(index) }
5067

68+
/** Gets all arguments. */
5169
Expr getArguments() { result = ArgumentsImpl.super.getArguments() }
5270
}
5371

5472
/**
55-
* A Parameter unknown AST node.
73+
* Represents a parameter node in the AST.
74+
* Provides access to the parameter's name and type.
5675
*/
5776
class Parameter extends AstNode instanceof ParameterImpl {
77+
/** Gets the name of the parameter. */
5878
Idents getName() { result = ParameterImpl.super.getName() }
5979

80+
/** Gets the type of the parameter. */
6081
Type getType() { result = ParameterImpl.super.getType() }
6182
}
6283

6384
/**
64-
* A Parameters unknown AST node.
85+
* Represents a parameters node in the AST.
86+
* Provides access to individual parameters by index.
6587
*/
6688
class Parameters extends AstNode instanceof ParametersImpl {
89+
/** Gets the parameter at the specified index. */
6790
Parameter getParameter(int index) { result = ParametersImpl.super.getParameter(index) }
6891
}
6992

7093
/**
71-
* A ParameterDeclaration unknown AST node.
94+
* Represents a parameter declaration node in the AST.
95+
* Provides access to the identifier, name, type, and default value of the parameter.
7296
*/
7397
class ParameterDeclaration extends AstNode instanceof ParameterDeclarationImpl {
98+
/** Gets the identifier of the parameter declaration. */
7499
Identifier getIdentifier() { result = ParameterDeclarationImpl.super.getName() }
75100

101+
/** Gets the name of the parameter declaration. */
76102
string getName() { result = this.getIdentifier().getName() }
77103

104+
/** Gets the type of the parameter declaration. */
78105
Type getType() { result = ParameterDeclarationImpl.super.getType() }
79106

107+
/** Gets the default value of the parameter declaration, if any. */
80108
Expr getDefaultValue() { result = ParameterDeclarationImpl.super.getDefaultValue() }
81109
}
82110

83111
/**
84-
* A OutputDeclaration unknown AST node.
112+
* Represents an output declaration node in the AST.
113+
* Provides access to the identifier, name, type, and value of the output.
85114
*/
86115
class OutputDeclaration extends AstNode instanceof OutputDeclarationImpl {
116+
/** Gets the identifier of the output declaration. */
87117
Identifier getIdentifier() { result = OutputDeclarationImpl.super.getIdentifier() }
88118

119+
/** Gets the name of the output declaration. */
89120
string getName() { result = this.getIdentifier().getName() }
90121

122+
/** Gets the type of the output declaration. */
91123
Type getType() { result = OutputDeclarationImpl.super.getType() }
92124

125+
/** Gets the value of the output declaration. */
93126
Expr getValue() { result = OutputDeclarationImpl.super.getValue() }
94127
}
95128

96129
/**
97-
* A UserDefinedFunction unknown AST node.
130+
* Represents a user-defined function node in the AST.
131+
* Provides access to the identifier, name, return type, parameters, and body of the function.
98132
*/
99133
class UserDefinedFunction extends AstNode instanceof UserDefinedFunctionImpl {
134+
/** Gets the identifier of the user-defined function. */
100135
Identifier getIdentifier() { result = UserDefinedFunctionImpl.super.getName() }
101136

137+
/** Gets the name of the user-defined function. */
102138
string getName() { result = this.getIdentifier().getName() }
103139

140+
/** Gets the return type of the user-defined function. */
104141
Type getReturnType() { result = UserDefinedFunctionImpl.super.getReturnType() }
105142

143+
/** Gets the declared parameters of the user-defined function. */
106144
Parameters getDeclaredParameters() { result = UserDefinedFunctionImpl.super.getParameters() }
107145

146+
/** Gets all parameters of the user-defined function. */
108147
Parameter getParameters() { result = this.getDeclaredParameters().getParameter(_) }
109148

149+
/** Gets the parameter at the specified index. */
110150
Parameter getParameter(int index) { result = this.getDeclaredParameters().getParameter(index) }
111151

152+
/** Gets the body of the user-defined function. */
112153
Expr getBody() { result = UserDefinedFunctionImpl.super.getBody() }
113154
}

0 commit comments

Comments
 (0)