Skip to content

Commit fb9da0f

Browse files
WasmParser: Move NameMap and ParsedNames to the top level
To avoid making these types under generic context
1 parent 5fc8579 commit fb9da0f

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Sources/WasmKit/Execution/NameRegistry.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import struct WasmParser.CustomSection
22
import struct WasmParser.NameSectionParser
3+
import struct WasmParser.NameMap
34
import class WasmParser.StaticByteStream
45

56
struct NameRegistry {
@@ -21,7 +22,7 @@ struct NameRegistry {
2122
}
2223
}
2324

24-
private mutating func register(instance: InternalInstance, nameMap: NameSectionParser.NameMap) {
25+
private mutating func register(instance: InternalInstance, nameMap: NameMap) {
2526
for (index, name) in nameMap {
2627
let addr = instance.functions[Int(index)]
2728
self.functionNames[addr] = name

Sources/WasmParser/WasmParser.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,21 +1174,21 @@ extension Parser {
11741174
}
11751175
}
11761176

1177+
/// A map of names by its index.
1178+
public typealias NameMap = [UInt32: String]
1179+
1180+
/// Parsed names.
1181+
public enum ParsedNames {
1182+
/// Function names.
1183+
case functions(NameMap)
1184+
}
1185+
11771186
/// A parser for the name custom section.
11781187
///
11791188
/// > Note: <https://webassembly.github.io/spec/core/appendix/custom.html#name-section>
11801189
public struct NameSectionParser<Stream: ByteStream> {
11811190
let stream: Stream
11821191

1183-
/// A map of names by its index.
1184-
public typealias NameMap = [UInt32: String]
1185-
1186-
/// Parsed names.
1187-
public enum ParsedNames {
1188-
/// Function names.
1189-
case functions(NameMap)
1190-
}
1191-
11921192
public init(stream: Stream) {
11931193
self.stream = stream
11941194
}

0 commit comments

Comments
 (0)