We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4fc0be2 + 58ad356 commit bbccbd3Copy full SHA for bbccbd3
SwiftCompilerSources/Sources/Optimizer/DataStructures/Stack.swift
@@ -47,17 +47,17 @@ struct Stack<Element> : CollectionLikeSequence {
47
48
mutating func next() -> Element? {
49
let end = (slab.data == lastSlab.data ? endIndex : slabCapacity)
50
- if index < end {
51
- let elem = Stack.bind(slab)[index]
52
- index += 1
53
-
54
- if index >= end && slab.data != lastSlab.data {
55
- slab = slab.getNext()
56
- index = 0
57
- }
58
- return elem
+
+ guard index < end else { return nil }
+ let elem = Stack.bind(slab)[index]
+ index += 1
+ if index >= end && slab.data != lastSlab.data {
+ slab = slab.getNext()
+ index = 0
59
}
60
- return nil
+ return elem
61
62
63
0 commit comments