Skip to content

Commit d93b5ea

Browse files
committed
SwiftCompilerSources: Add SingleInlineArray.popLast()
1 parent c6f7a92 commit d93b5ea

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

SwiftCompilerSources/Sources/SIL/Utilities/SequenceUtilities.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,13 @@ public struct SingleInlineArray<Element>: RandomAccessCollection, FormattedLikeA
167167
}
168168
multipleElements.append(element)
169169
}
170+
171+
public mutating func popLast() -> Element? {
172+
if multipleElements.isEmpty {
173+
let last = singleElement
174+
singleElement = nil
175+
return last
176+
}
177+
return multipleElements.popLast()
178+
}
170179
}

0 commit comments

Comments
 (0)