Skip to content

Commit 813e425

Browse files
Move EngineInterceptor to a separate file
The file was created but the code was not moved to it
1 parent 191f668 commit 813e425

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

Sources/WasmKit/Engine.swift

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -96,36 +96,6 @@ public struct EngineConfiguration {
9696
}
9797
}
9898

99-
@_documentation(visibility: internal)
100-
public protocol EngineInterceptor {
101-
func onEnterFunction(_ function: Function)
102-
func onExitFunction(_ function: Function)
103-
}
104-
105-
/// An interceptor that multiplexes multiple interceptors
106-
@_documentation(visibility: internal)
107-
public class MultiplexingInterceptor: EngineInterceptor {
108-
private let interceptors: [EngineInterceptor]
109-
110-
/// Creates a new multiplexing interceptor
111-
/// - Parameter interceptors: The interceptors to multiplex
112-
public init(_ interceptors: [EngineInterceptor]) {
113-
self.interceptors = interceptors
114-
}
115-
116-
public func onEnterFunction(_ function: Function) {
117-
for interceptor in interceptors {
118-
interceptor.onEnterFunction(function)
119-
}
120-
}
121-
122-
public func onExitFunction(_ function: Function) {
123-
for interceptor in interceptors {
124-
interceptor.onExitFunction(function)
125-
}
126-
}
127-
}
128-
12999
extension Engine {
130100
func resolveType(_ type: InternedFuncType) -> FunctionType {
131101
return funcTypeInterner.resolve(type)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@_documentation(visibility: internal)
2+
public protocol EngineInterceptor {
3+
func onEnterFunction(_ function: Function)
4+
func onExitFunction(_ function: Function)
5+
}
6+
7+
/// An interceptor that multiplexes multiple interceptors
8+
@_documentation(visibility: internal)
9+
public class MultiplexingInterceptor: EngineInterceptor {
10+
private let interceptors: [EngineInterceptor]
11+
12+
/// Creates a new multiplexing interceptor
13+
/// - Parameter interceptors: The interceptors to multiplex
14+
public init(_ interceptors: [EngineInterceptor]) {
15+
self.interceptors = interceptors
16+
}
17+
18+
public func onEnterFunction(_ function: Function) {
19+
for interceptor in interceptors {
20+
interceptor.onEnterFunction(function)
21+
}
22+
}
23+
24+
public func onExitFunction(_ function: Function) {
25+
for interceptor in interceptors {
26+
interceptor.onExitFunction(function)
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)