Skip to content

Commit 204f5d6

Browse files
committed
Improve Local Variable Names
1 parent c171fed commit 204f5d6

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

Foundation/NSPathUtilities.swift

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,29 @@ internal extension String {
5555

5656
internal var _startOfPathExtension : String.Index? {
5757
precondition(!hasSuffix("/"))
58-
59-
var curPos = endIndex
60-
let lastCompStartPos = _startOfLastPathComponent
61-
58+
59+
var currentPosition = endIndex
60+
let startOfLastPathComponent = _startOfLastPathComponent
61+
6262
// Find the beginning of the extension
63-
while curPos > lastCompStartPos {
64-
let prevPos = index(before: curPos)
65-
let char = self[prevPos]
66-
if char == "/" {
63+
while currentPosition > startOfLastPathComponent {
64+
let previousPosition = index(before: currentPosition)
65+
let character = self[previousPosition]
66+
if character == "/" {
6767
return nil
68-
} else if char == "." {
69-
if lastCompStartPos == prevPos {
68+
} else if character == "." {
69+
if startOfLastPathComponent == previousPosition {
7070
return nil
71-
} else if case let prevPrevPos = index(before: prevPos), prevPos == index(before: endIndex) && prevPrevPos == lastCompStartPos && self[prevPrevPos] == "." {
71+
} else if case let previous2Position = index(before: previousPosition),
72+
previousPosition == index(before: endIndex) &&
73+
previous2Position == startOfLastPathComponent && self[previous2Position] == "."
74+
{
7275
return nil
7376
} else {
74-
return curPos
77+
return currentPosition
7578
}
7679
}
77-
curPos = prevPos
80+
currentPosition = previousPosition
7881
}
7982
return nil
8083
}

0 commit comments

Comments
 (0)