Skip to content

Commit 57a55ed

Browse files
committed
Swift: QL solution (arguably clearer, seems more performant).
1 parent 8205751 commit 57a55ed

File tree

1 file changed

+2
-5
lines changed
  • swift/ql/lib/codeql/swift/elements/type

1 file changed

+2
-5
lines changed

swift/ql/lib/codeql/swift/elements/type/Type.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ class Type extends Generated::Type {
1212
* Gets the name of this type.
1313
*/
1414
override string getName() {
15-
/*exists(string name, int lastDotPos |
15+
exists(string name, int lastDotPos |
1616
name = super.getName() and
1717
lastDotPos = max([-1, name.indexOf(".")]) and
1818
result = name.suffix(lastDotPos + 1)
19-
)*/
20-
// match as many characters as possible at the end that are not `.`.
21-
// (`*?` is lazy matching)
22-
result = super.getName().regexpCapture(".*?([^\\.]*)", 1)
19+
)
2320
}
2421

2522
/**

0 commit comments

Comments
 (0)