File tree Expand file tree Collapse file tree
ql/lib/codeql/swift/elements Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11private import codeql.swift.generated.Callable
22private import codeql.swift.elements.AstNode
3+ private import codeql.swift.elements.decl.Decl
34
4- class Callable extends Generated:: Callable , AstNode { }
5+ class Callable extends Generated:: Callable , AstNode {
6+ /**
7+ * Holds if this Callable is a function named `funcName`.
8+ */
9+ predicate hasName ( string funcName ) { this .getName ( ) = funcName }
10+
11+ /**
12+ * Holds if this Callable is a function named `funcName` defined in a module
13+ * called `moduleName`.
14+ */
15+ predicate hasName ( string moduleName , string funcName ) {
16+ this .hasName ( funcName ) and
17+ this .( Decl ) .getModule ( ) .getFullName ( ) = moduleName
18+ }
19+ }
Original file line number Diff line number Diff line change 11private import codeql.swift.generated.decl.AbstractFunctionDecl
22private import codeql.swift.elements.decl.MethodDecl
3+ private import codeql.swift.elements.Callable
34
45/**
56 * A function.
67 */
7- class AbstractFunctionDecl extends Generated:: AbstractFunctionDecl {
8+ class AbstractFunctionDecl extends Generated:: AbstractFunctionDecl , Callable {
89 override string toString ( ) { result = this .getName ( ) }
9-
10- /**
11- * Holds if this function is called `funcName`.
12- */
13- predicate hasName ( string funcName ) { this .getName ( ) = funcName }
1410}
1511
1612/**
Original file line number Diff line number Diff line change @@ -177,12 +177,13 @@ class ParamDecl(VarDecl):
177177 """ )
178178
179179class Callable (Element ):
180+ name : optional [string ] | doc ("name of this Callable" )
180181 self_param : optional [ParamDecl ] | child
181182 params : list [ParamDecl ] | child
182183 body : optional ["BraceStmt" ] | child | desc ("The body is absent within protocol declarations." )
183184
184185class AbstractFunctionDecl (GenericContext , ValueDecl , Callable ):
185- name : string | doc ( "name of this function" )
186+ pass
186187
187188class EnumElementDecl (ValueDecl ):
188189 name : string
You can’t perform that action at this time.
0 commit comments