Fix breakage due to write_lock()
This commit is contained in:
parent
6475e4e20e
commit
be315aebaf
@ -220,7 +220,7 @@ impl ExportedFn {
|
||||
}
|
||||
};
|
||||
let downcast_span = quote_spanned!(
|
||||
arg_type.span()=> &mut *args[0usize].write_lock::<#arg_type>().unwrap());
|
||||
arg_type.span()=> &mut args[0usize].write_lock::<#arg_type>().unwrap());
|
||||
unpack_stmts.push(
|
||||
syn::parse2::<syn::Stmt>(quote! {
|
||||
let #var: &mut _ = #downcast_span;
|
||||
@ -784,7 +784,7 @@ mod generate_tests {
|
||||
args.len(), 2usize), Position::none())));
|
||||
}
|
||||
let arg1 = args[1usize].downcast_clone::<usize>().unwrap();
|
||||
let arg0: &mut _ = args[0usize].write_lock::<usize>().unwrap();
|
||||
let arg0: &mut _ = &mut args[0usize].write_lock::<usize>().unwrap();
|
||||
Ok(Dynamic::from(increment(arg0, arg1)))
|
||||
}
|
||||
|
||||
|
@ -667,7 +667,7 @@ mod generate_tests {
|
||||
format!("wrong arg count: {} != {}",
|
||||
args.len(), 1usize), Position::none())));
|
||||
}
|
||||
let arg0: &mut _ = args[0usize].write_lock::<FLOAT>().unwrap();
|
||||
let arg0: &mut _ = &mut args[0usize].write_lock::<FLOAT>().unwrap();
|
||||
Ok(Dynamic::from(increment(arg0)))
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ pub(crate) fn generate_body(
|
||||
let mut gen_fn_tokens: Vec<proc_macro2::TokenStream> = Vec::new();
|
||||
for function in fns {
|
||||
let fn_token_name = syn::Ident::new(
|
||||
&format!("{}_Token", function.name().to_string()),
|
||||
&format!("{}_token", function.name().to_string()),
|
||||
function.name().span(),
|
||||
);
|
||||
let fn_literal =
|
||||
|
@ -39,10 +39,10 @@ pub trait RegisterPlugin<PL: crate::plugin::Plugin> {
|
||||
/// fn is_varadic(&self) -> bool { false }
|
||||
///
|
||||
/// fn call(&self, args: &mut[&mut Dynamic], pos: Position) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
/// let x1: &FLOAT = args[0].downcast_ref::<FLOAT>().unwrap();
|
||||
/// let y1: &FLOAT = args[1].downcast_ref::<FLOAT>().unwrap();
|
||||
/// let x2: &FLOAT = args[2].downcast_ref::<FLOAT>().unwrap();
|
||||
/// let y2: &FLOAT = args[3].downcast_ref::<FLOAT>().unwrap();
|
||||
/// let x1: FLOAT = args[0].downcast_clone::<FLOAT>().unwrap();
|
||||
/// let y1: FLOAT = args[1].downcast_clone::<FLOAT>().unwrap();
|
||||
/// let x2: FLOAT = args[2].downcast_clone::<FLOAT>().unwrap();
|
||||
/// let y2: FLOAT = args[3].downcast_clone::<FLOAT>().unwrap();
|
||||
/// let square_sum = (y2 - y1).abs().powf(2.0) + (x2 -x1).abs().powf(2.0);
|
||||
/// Ok(Dynamic::from(square_sum.sqrt()))
|
||||
/// }
|
||||
|
@ -102,6 +102,8 @@ pub use rhai_codegen::*;
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
pub use parser::FnAccess;
|
||||
#[cfg(feature = "no_function")]
|
||||
pub use parser::FnAccess;
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
pub use fn_func::Func;
|
||||
|
Loading…
Reference in New Issue
Block a user