Clean up
This commit is contained in:
parent
e9a414d504
commit
27c5501ab0
|
@ -56,22 +56,5 @@ pub fn derive_externals(_attr: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
let ext_def = parser::parse(input.clone()).unwrap();
|
let ext_def = parser::parse(input.clone()).unwrap();
|
||||||
codegen::codegen(&ext_def, &mut input);
|
codegen::codegen(&ext_def, &mut input);
|
||||||
|
|
||||||
// We need to generate two types:
|
input.into()
|
||||||
// - 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
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ impl<'a> Runtime<'a> {
|
||||||
/// Puts a mark of the current player on the given cell.
|
/// 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
|
/// 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> {
|
pub fn set(&mut self, idx: i32) -> Result<(), Error> {
|
||||||
if self.made_turn {
|
if self.made_turn {
|
||||||
return Err(Error::AlreadyPlayed);
|
return Err(Error::AlreadyPlayed);
|
||||||
|
|
Loading…
Reference in New Issue