use crate::{
interpreter::Instruction,
types::{InterfaceType, RecordType},
};
use std::str;
#[derive(PartialEq, Debug)]
pub enum TypeKind {
Function,
Record,
}
#[derive(PartialEq, Debug)]
pub enum Type {
Function {
inputs: Vec<InterfaceType>,
outputs: Vec<InterfaceType>,
},
Record(RecordType),
}
#[derive(PartialEq, Debug)]
pub struct Import<'input> {
pub namespace: &'input str,
pub name: &'input str,
pub signature_type: u32,
}
#[derive(PartialEq, Debug)]
pub struct Export<'input> {
pub name: &'input str,
pub function_type: u32,
}
#[derive(PartialEq, Debug)]
pub struct Adapter {
pub function_type: u32,
pub instructions: Vec<Instruction>,
}
#[derive(PartialEq, Debug)]
pub struct Implementation {
pub core_function_type: u32,
pub adapter_function_type: u32,
}
#[derive(PartialEq, Debug)]
pub(crate) enum InterfaceKind {
Type,
Import,
Adapter,
Export,
Implementation,
}
#[derive(PartialEq, Default, Debug)]
pub struct Interfaces<'input> {
pub types: Vec<Type>,
pub imports: Vec<Import<'input>>,
pub adapters: Vec<Adapter>,
pub exports: Vec<Export<'input>>,
pub implementations: Vec<Implementation>,
}