Skip to content

Commit c28574e

Browse files
Merge pull request #91 from kabiroberai/kabir/drop-foundation
Lower deployment target to macOS 10.13
2 parents 36270de + e847256 commit c28574e

File tree

9 files changed

+34
-5
lines changed

9 files changed

+34
-5
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import class Foundation.ProcessInfo
55

66
let package = Package(
77
name: "WasmKit",
8-
platforms: [.macOS(.v11), .iOS(.v14)],
8+
platforms: [.macOS(.v10_13), .iOS(.v12)],
99
products: [
1010
.library(
1111
name: "WasmKit",

Sources/Spectest/Spectest.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import SystemPackage
44
import WasmKit
55

66
@main
7+
@available(macOS 11, *)
78
struct Spectest: AsyncParsableCommand {
89
@Argument
910
var path: String

Sources/WITExtractor/ModuleTranslation.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@available(macOS 11, *)
12
struct ModuleTranslation {
23
let diagnostics: DiagnosticCollection
34
let typeMapping: TypeMapping

Sources/WITExtractor/SourceSummary.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public struct SwiftFunctionSource {
4949
let name: String
5050
}
5151

52+
@available(macOS 11, *)
5253
struct SourceSummaryBuilder {
5354
let diagnostics: DiagnosticCollection
5455
let typeMapping: TypeMapping

Sources/WITExtractor/SwiftAPIDigester.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ struct SwiftAPIDigester {
116116
typealias SDKNodeType = SDKNodeInherit<SDKNodeBody, SDKNodeTypeBody>
117117
typealias SDKNodeTypeNominal = SDKNodeInherit<SDKNodeType, SDKNodeTypeNominalBody>
118118

119+
@available(macOS 11, *)
119120
func dumpSDK(moduleName: String, arguments: [String]) throws -> Output {
120121
var args = [
121122
"-dump-sdk",

Sources/WITExtractor/TypeMapping.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@available(macOS 11, *)
12
struct TypeMapping {
23
typealias DeclScope = [SwiftAPIDigester.SDKNodeDecl]
34
struct DeclSource {

Sources/WITExtractor/WITExtractor.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public struct WITExtractor {
3131
}
3232

3333
public func run(moduleName: String) throws -> Output {
34+
guard #available(macOS 11, *) else {
35+
fatalError("WITExtractor requires macOS 11+")
36+
}
3437
let header = """
3538
// DO NOT EDIT.
3639
//
@@ -42,6 +45,7 @@ public struct WITExtractor {
4245
return output
4346
}
4447

48+
@available(macOS 11, *)
4549
func runWithoutHeader(moduleName: String) throws -> Output {
4650
let output = try digester.dumpSDK(moduleName: moduleName, arguments: extraDigesterArguments)
4751
var typeMapping = TypeMapping()

Sources/WITTool/WITTool.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ struct ExtractWIT: ParsableCommand {
123123
var digesterArgs: [String] = []
124124

125125
func run() throws {
126+
guard #available(macOS 11, *) else {
127+
fatalError("ExtractWIT requires macOS 11+")
128+
}
129+
126130
let extractor = WITExtractor(
127131
namespace: namespace,
128132
packageName: packageName,

Sources/WasmKit/Execution/Runtime/Stack.swift

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,16 @@ struct ValueStack {
157157
}
158158

159159
extension ValueStack: Sequence {
160-
func makeIterator() -> some IteratorProtocol {
161-
self.values[..<count].makeIterator()
160+
struct Iterator: IteratorProtocol {
161+
fileprivate var base: UnsafeMutableBufferPointer<Value>.SubSequence.Iterator
162+
163+
mutating func next() -> Value? {
164+
base.next()
165+
}
166+
}
167+
168+
func makeIterator() -> Iterator {
169+
Iterator(base: self.values[..<count].makeIterator())
162170
}
163171
}
164172

@@ -207,8 +215,16 @@ struct FixedSizeStack<Element> {
207215
}
208216

209217
extension FixedSizeStack: Sequence {
210-
func makeIterator() -> some IteratorProtocol<Element> {
211-
self.buffer[..<numberOfElements].makeIterator()
218+
struct Iterator: IteratorProtocol {
219+
fileprivate var base: UnsafeMutableBufferPointer<Element>.SubSequence.Iterator
220+
221+
mutating func next() -> Element? {
222+
base.next()
223+
}
224+
}
225+
226+
func makeIterator() -> Iterator {
227+
Iterator(base: self.buffer[..<numberOfElements].makeIterator())
212228
}
213229
}
214230

0 commit comments

Comments
 (0)