Skip to content

Commit 65fd9cb

Browse files
committed
Swift: docname and desc examples
1 parent 35c1d31 commit 65fd9cb

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

swift/ql/lib/codeql/swift/generated/Callable.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ module Generated {
6565

6666
/**
6767
* Gets the body, if it exists.
68+
*
69+
* The body is absent within protocol declarations.
6870
*/
6971
final BraceStmt getBody() { result = getImmediateBody().resolve() }
7072

swift/ql/lib/codeql/swift/generated/type/GenericFunctionType.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import codeql.swift.elements.type.AnyFunctionType
55
import codeql.swift.elements.type.GenericTypeParamType
66

77
module Generated {
8+
/**
9+
* The type of a generic function with type parameters
10+
*/
811
class GenericFunctionType extends Synth::TGenericFunctionType, AnyFunctionType {
912
override string getAPrimaryQlClass() { result = "GenericFunctionType" }
1013

1114
/**
12-
* Gets the `index`th generic param.
15+
* Gets the `index`th generic parameter.
1316
* This is taken from the "hidden" AST and should only be used to be overridden by classes.
1417
*/
1518
GenericTypeParamType getImmediateGenericParam(int index) {
@@ -20,19 +23,19 @@ module Generated {
2023
}
2124

2225
/**
23-
* Gets the `index`th generic param.
26+
* Gets the `index`th generic parameter.
2427
*/
2528
final GenericTypeParamType getGenericParam(int index) {
2629
result = getImmediateGenericParam(index).resolve()
2730
}
2831

2932
/**
30-
* Gets any of the generic params.
33+
* Gets any of the generic parameters.
3134
*/
3235
final GenericTypeParamType getAGenericParam() { result = getGenericParam(_) }
3336

3437
/**
35-
* Gets the number of generic params.
38+
* Gets the number of generic parameters.
3639
*/
3740
final int getNumberOfGenericParams() { result = count(getAGenericParam()) }
3841
}

swift/schema.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class ParamDecl(VarDecl):
139139
class Callable(Element):
140140
self_param: optional[ParamDecl] | child
141141
params: list[ParamDecl] | child
142-
body: optional["BraceStmt"] | child
142+
body: optional["BraceStmt"] | child | desc("The body is absent within protocol declarations.")
143143

144144
class AbstractFunctionDecl(GenericContext, ValueDecl, Callable):
145145
name: string
@@ -903,7 +903,8 @@ class FunctionType(AnyFunctionType):
903903
pass
904904

905905
class GenericFunctionType(AnyFunctionType):
906-
generic_params: list["GenericTypeParamType"]
906+
""" The type of a generic function with type parameters """
907+
generic_params: list["GenericTypeParamType"] | docname("generic parameters")
907908

908909
class GenericTypeParamType(SubstitutableType):
909910
pass

0 commit comments

Comments
 (0)