Skip to content

Commit

Permalink
Merge branch 'master' into features/refactor-bin
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary authored Apr 6, 2020
2 parents 20d4a56 + 99f8c94 commit c475950
Show file tree
Hide file tree
Showing 26 changed files with 2,653 additions and 329 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## **[Unreleased]**

- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files
- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT
- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines
- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API
- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lib/interface-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ edition = "2018"
[dependencies]
nom = "5.1"
wast = "8.0"

# `serde` is useful only to simplify the users' life. It is not
# required by WIT itself, is is used to cross the boundary between the
# host and WIT more easily, but it is not used inside Wasm.
serde = { version = "1.0", features = ["derive"], optional = true }

[features]
default = ["serde"]
52 changes: 41 additions & 11 deletions lib/interface-types/src/ast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Represents the WIT language as a tree. This is the central
//! representation of the language.
use crate::interpreter::Instruction;
use crate::{interpreter::Instruction, vec1::Vec1};
use std::str;

/// Represents the types supported by WIT.
Expand Down Expand Up @@ -48,20 +48,50 @@ pub enum InterfaceType {

/// A 64-bits integer (as defiend in WebAssembly core).
I64,

/// A record.
Record(RecordType),
}

/// Represents a record type.
#[derive(PartialEq, Debug, Clone)]
pub struct RecordType {
/// Types representing the fields.
pub fields: Vec1<InterfaceType>,
}

/// Represents a type signature.
///
/// ```wasm,ignore
/// (@interface type (param i32 i32) (result string))
/// ```
/// Represents the kind of type.
#[derive(PartialEq, Debug)]
pub struct Type {
/// Types for the parameters (`(param …)`).
pub inputs: Vec<InterfaceType>,
pub enum TypeKind {
/// A function type.
Function,

/// Types for the results (`(result …)`).
pub outputs: Vec<InterfaceType>,
/// A record type.
Record,
}

/// Represents a type.
#[derive(PartialEq, Debug)]
pub enum Type {
/// A function type, like:
///
/// ```wasm,ignore
/// (@interface type (func (param i32 i32) (result string)))
/// ```
Function {
/// Types for the parameters (`(param …)`).
inputs: Vec<InterfaceType>,

/// Types for the results (`(result …)`).
outputs: Vec<InterfaceType>,
},

/// A record type, like:
///
/// ```wasm,ignore
/// (@interface type (record string i32))
/// ```
Record(RecordType),
}

/// Represents an imported function.
Expand Down
Loading

0 comments on commit c475950

Please sign in to comment.