mirror of
https://github.com/fluencelabs/interface-types
synced 2025-04-25 07:42:14 +00:00
feat(interface-types) Let the type inference engine do the work.
This commit is contained in:
parent
cabb277f14
commit
cae0640d75
@ -88,28 +88,26 @@ where
|
||||
fn try_from(instructions: &Vec<Instruction>) -> Result<Self, Self::Error> {
|
||||
let executable_instructions = instructions
|
||||
.iter()
|
||||
.map(
|
||||
|instruction| -> ExecutableInstruction<Instance, Export, LocalImport, Memory> {
|
||||
let instruction_name: String = instruction.into();
|
||||
.map(|instruction| {
|
||||
let instruction_name: String = instruction.into();
|
||||
|
||||
match instruction {
|
||||
Instruction::ArgumentGet { index } => {
|
||||
instructions::argument_get(*index, instruction_name)
|
||||
}
|
||||
Instruction::Call { function_index } => {
|
||||
instructions::call(*function_index, instruction_name)
|
||||
}
|
||||
Instruction::CallExport { export_name } => {
|
||||
instructions::call_export((*export_name).to_owned(), instruction_name)
|
||||
}
|
||||
Instruction::ReadUtf8 => instructions::read_utf8(instruction_name),
|
||||
Instruction::WriteUtf8 { allocator_name } => {
|
||||
instructions::write_utf8((*allocator_name).to_owned(), instruction_name)
|
||||
}
|
||||
_ => unimplemented!(),
|
||||
match instruction {
|
||||
Instruction::ArgumentGet { index } => {
|
||||
instructions::argument_get(*index, instruction_name)
|
||||
}
|
||||
},
|
||||
)
|
||||
Instruction::Call { function_index } => {
|
||||
instructions::call(*function_index, instruction_name)
|
||||
}
|
||||
Instruction::CallExport { export_name } => {
|
||||
instructions::call_export((*export_name).to_owned(), instruction_name)
|
||||
}
|
||||
Instruction::ReadUtf8 => instructions::read_utf8(instruction_name),
|
||||
Instruction::WriteUtf8 { allocator_name } => {
|
||||
instructions::write_utf8((*allocator_name).to_owned(), instruction_name)
|
||||
}
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
Ok(Interpreter {
|
||||
|
Loading…
x
Reference in New Issue
Block a user