Skip to content

Commit deb97a6

Browse files
committed
Swift: Improve regex performance with possessive matching (i.e. don't backtrack).
1 parent 5f7e5b9 commit deb97a6

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Type extends Generated::Type {
1515
// replace anything that looks like a full name `a.b.c` with just the
1616
// short name `c`, by removing the `a.` and `b.` parts. Note that this
1717
// has to be robust for tuple type names such as `(a, b.c)`.
18-
result = super.getName().regexpReplaceAll("[^(),. ]+\\.(?!\\.)", "")
18+
result = super.getName().regexpReplaceAll("[^(),. ]++\\.(?!\\.)", "")
1919
}
2020

2121
/**

0 commit comments

Comments
 (0)