File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
swift/ql/lib/codeql/swift Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,16 @@ private import codeql.swift.elements.decl.Method
6
6
*/
7
7
class Function extends Generated:: Function , Callable {
8
8
override string toString ( ) { result = this .getName ( ) }
9
+
10
+ /**
11
+ * Gets the name of this function, without the argument list. For example
12
+ * a function with name `myFunction(arg:)` has short name `myFunction`.
13
+ */
14
+ string getShortName ( ) {
15
+ // match as many characters as possible that are not `(`.
16
+ // (`*+` is possessive matching)
17
+ result = this .getName ( ) .regexpCapture ( "([^(]*+).*" , 1 )
18
+ }
9
19
}
10
20
11
21
/**
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ private class SensitiveFunction extends Function {
102
102
string name ; // name of the function, not including the argument list.
103
103
104
104
SensitiveFunction ( ) {
105
- name = this .getName ( ) . splitAt ( "(" , 0 ) and
105
+ name = this .getShortName ( ) and
106
106
name .regexpMatch ( sensitiveType .getRegexp ( ) )
107
107
}
108
108
You can’t perform that action at this time.
0 commit comments