This commit is contained in:
Sergey Pepyakin 2019-01-25 13:02:11 +01:00
parent e9a414d504
commit 27c5501ab0
2 changed files with 2 additions and 19 deletions

View File

@ -56,22 +56,5 @@ pub fn derive_externals(_attr: TokenStream, input: TokenStream) -> TokenStream {
let ext_def = parser::parse(input.clone()).unwrap();
codegen::codegen(&ext_def, &mut input);
// We need to generate two types:
// - Externals
// - ModuleImportResolver
// - for each of declared method collect it's name and it's signature.
// - assign a method index for each method
// - generate a switch for `Externals` that takes the input `index` and jumps
// on the corresponding match arm, which the wrapper.
// The wrapper decodes arguments, calls to the function and handles the result.
// - generate a switch / ifs chain for `ModuleImportResolver`. In each arm it checks if the function
// has an appropriate arguments, and if so allocates a host function with the corresponding index.
//
// and we will then need to return both the original implementation and the generated implementation
// of externals.
println!("{:?}", quote::quote! { #input }.to_string());
let input = input.into();
input
input.into()
}

View File

@ -137,7 +137,7 @@ impl<'a> Runtime<'a> {
/// Puts a mark of the current player on the given cell.
///
/// Traps if the index is out of bounds of game field or if the player
/// already made it's turn.
/// already made its turn.
pub fn set(&mut self, idx: i32) -> Result<(), Error> {
if self.made_turn {
return Err(Error::AlreadyPlayed);