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
66 */
77class Function extends Generated:: Function , Callable {
88 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+ }
919}
1020
1121/**
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ private class SensitiveFunction extends Function {
102102 string name ; // name of the function, not including the argument list.
103103
104104 SensitiveFunction ( ) {
105- name = this .getName ( ) . splitAt ( "(" , 0 ) and
105+ name = this .getShortName ( ) and
106106 name .regexpMatch ( sensitiveType .getRegexp ( ) )
107107 }
108108
You can’t perform that action at this time.
0 commit comments