Skip to content

Commit 6b3d62c

Browse files
committed
SwiftCompilerSources: Add append methods to SingleInlineArray.
1 parent ce3f488 commit 6b3d62c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

SwiftCompilerSources/Sources/SIL/Utilities/SequenceUtilities.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,17 @@ public struct SingleInlineArray<Element>: RandomAccessCollection, FormattedLikeA
154154
}
155155
}
156156

157-
public mutating func push(_ element: Element) {
157+
public mutating func append(_ element: __owned Element) {
158+
push(element)
159+
}
160+
161+
public mutating func append<S: Sequence>(contentsOf newElements: __owned S) where S.Element == Element {
162+
for element in newElements {
163+
push(element)
164+
}
165+
}
166+
167+
public mutating func push(_ element: __owned Element) {
158168
guard singleElement != nil else {
159169
singleElement = element
160170
return

0 commit comments

Comments
 (0)