mirror of
https://github.com/fluencelabs/interface-types
synced 2024-12-04 15:20:20 +00:00
update
This commit is contained in:
parent
37458bc559
commit
d4cb5622ac
@ -222,10 +222,10 @@ where
|
||||
MemoryView: wasm::structures::MemoryView,
|
||||
Instance: wasm::structures::Instance<Export, LocalImport, Memory, MemoryView>,
|
||||
{
|
||||
let func_inputs = local_import.inputs();
|
||||
let func_inputs = local_import.arguments();
|
||||
|
||||
for (func_input_arg, value) in func_inputs.iter().zip(values.iter()) {
|
||||
is_value_compatible_to_type(instance, &func_input_arg, value, instruction)?;
|
||||
is_value_compatible_to_type(instance, &func_input_arg.ty, value, instruction)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -363,7 +363,7 @@ pub(crate) mod tests {
|
||||
self.outputs.len()
|
||||
}
|
||||
|
||||
fn inputs(&self) -> &[InterfaceType] {
|
||||
fn arguments(&self) -> &[InterfaceType] {
|
||||
&self.inputs
|
||||
}
|
||||
|
||||
@ -391,7 +391,7 @@ pub(crate) mod tests {
|
||||
self.outputs.len()
|
||||
}
|
||||
|
||||
fn inputs(&self) -> &[InterfaceType] {
|
||||
fn arguments(&self) -> &[InterfaceType] {
|
||||
&self.inputs
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
use crate::types::RecordType;
|
||||
use crate::{types::InterfaceType, values::InterfaceValue};
|
||||
use std::{cell::Cell, ops::Deref};
|
||||
use crate::ast::FunctionArg;
|
||||
|
||||
pub trait TypedIndex: Copy + Clone {
|
||||
fn new(index: usize) -> Self;
|
||||
@ -43,7 +44,7 @@ impl LocalImportIndex for FunctionIndex {
|
||||
pub trait Export {
|
||||
fn inputs_cardinality(&self) -> usize;
|
||||
fn outputs_cardinality(&self) -> usize;
|
||||
fn inputs(&self) -> &[InterfaceType];
|
||||
fn arguments(&self) -> &[FunctionArg];
|
||||
fn outputs(&self) -> &[InterfaceType];
|
||||
fn call(&self, arguments: &[InterfaceValue]) -> Result<Vec<InterfaceValue>, ()>;
|
||||
}
|
||||
@ -51,7 +52,7 @@ pub trait Export {
|
||||
pub trait LocalImport {
|
||||
fn inputs_cardinality(&self) -> usize;
|
||||
fn outputs_cardinality(&self) -> usize;
|
||||
fn inputs(&self) -> &[InterfaceType];
|
||||
fn arguments(&self) -> &[FunctionArg];
|
||||
fn outputs(&self) -> &[InterfaceType];
|
||||
fn call(&self, arguments: &[InterfaceValue]) -> Result<Vec<InterfaceValue>, ()>;
|
||||
}
|
||||
@ -88,7 +89,7 @@ impl Export for () {
|
||||
0
|
||||
}
|
||||
|
||||
fn inputs(&self) -> &[InterfaceType] {
|
||||
fn arguments(&self) -> &[FunctionArg] {
|
||||
&[]
|
||||
}
|
||||
|
||||
@ -110,7 +111,7 @@ impl LocalImport for () {
|
||||
0
|
||||
}
|
||||
|
||||
fn inputs(&self) -> &[InterfaceType] {
|
||||
fn arguments(&self) -> &[FunctionArg] {
|
||||
&[]
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ use crate::vec1::Vec1;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Represents the types supported by WIT.
|
||||
#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum InterfaceType {
|
||||
/// A 8-bits signed integer.
|
||||
S8,
|
||||
@ -57,7 +57,7 @@ pub enum InterfaceType {
|
||||
}
|
||||
|
||||
/// Represents a record field type.
|
||||
#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct RecordFieldType {
|
||||
// TODO: make name optional to support structures with anonymous fields in Rust
|
||||
/// A field name.
|
||||
|
Loading…
Reference in New Issue
Block a user