@@ -314,7 +314,7 @@ enum WasmGen {
314
314
return code
315
315
}
316
316
317
- static func generateTextParser ( _ instructions: InstructionSet ) -> String {
317
+ static func generateTextInstructionParser ( _ instructions: InstructionSet ) -> String {
318
318
var code = """
319
319
import WasmParser
320
320
import WasmTypes
@@ -399,13 +399,14 @@ enum WasmGen {
399
399
return code
400
400
}
401
401
402
- static func generateInstructionEncoder ( _ instructions: InstructionSet ) -> String {
402
+ static func generateBinaryInstructionEncoder ( _ instructions: InstructionSet ) -> String {
403
403
var code = """
404
404
import WasmParser
405
405
import WasmTypes
406
406
407
- /// An instruction encoder that is responsible for encoding opcodes and immediates.
408
- protocol InstructionEncoder: InstructionVisitor {
407
+ /// An instruction encoder that is responsible for encoding opcodes and immediates
408
+ /// in Wasm binary format.
409
+ protocol BinaryInstructionEncoder: InstructionVisitor {
409
410
/// Encodes an instruction opcode.
410
411
mutating func encodeInstruction(_ opcode: UInt8, _ prefix: UInt8?) throws
411
412
@@ -443,8 +444,8 @@ enum WasmGen {
443
444
code += """
444
445
}
445
446
446
- // InstructionEncoder implements the InstructionVisitor protocol to call the corresponding encode method.
447
- extension InstructionEncoder {
447
+ // BinaryInstructionEncoder implements the InstructionVisitor protocol to call the corresponding encode method.
448
+ extension BinaryInstructionEncoder {
448
449
449
450
"""
450
451
@@ -613,12 +614,12 @@ enum WasmGen {
613
614
+ " \n "
614
615
) ,
615
616
GeneratedFile (
616
- projectSources + [ " WAT " , " ParseInstruction .swift" ] ,
617
- header + generateTextParser ( instructions)
617
+ projectSources + [ " WAT " , " ParseTextInstruction .swift" ] ,
618
+ header + generateTextInstructionParser ( instructions)
618
619
) ,
619
620
GeneratedFile (
620
- projectSources + [ " WAT " , " InstructionEncoder .swift" ] ,
621
- header + generateInstructionEncoder ( instructions)
621
+ projectSources + [ " WAT " , " BinaryInstructionEncoder .swift" ] ,
622
+ header + generateBinaryInstructionEncoder ( instructions)
622
623
) ,
623
624
]
624
625
0 commit comments