mirror of
https://github.com/denoland/deno.git
synced 2025-01-18 03:44:05 -05:00
refactor(core): make borrow_mut
more explicit in the ops macro (#16025)
This commit is contained in:
parent
40009ebc94
commit
07213dec94
1 changed files with 3 additions and 3 deletions
|
@ -284,7 +284,7 @@ fn opstate_arg(arg: &FnArg) -> Option<TokenStream2> {
|
||||||
match arg {
|
match arg {
|
||||||
arg if is_rc_refcell_opstate(arg) => Some(quote! { ctx.state.clone(), }),
|
arg if is_rc_refcell_opstate(arg) => Some(quote! { ctx.state.clone(), }),
|
||||||
arg if is_mut_ref_opstate(arg) => {
|
arg if is_mut_ref_opstate(arg) => {
|
||||||
Some(quote! { &mut ctx.state.borrow_mut(), })
|
Some(quote! { &mut std::cell::RefCell::borrow_mut(&ctx.state), })
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ fn codegen_fast_impl(
|
||||||
&*(#core::v8::Local::<#core::v8::External>::cast(data).value()
|
&*(#core::v8::Local::<#core::v8::External>::cast(data).value()
|
||||||
as *const #core::_ops::OpCtx)
|
as *const #core::_ops::OpCtx)
|
||||||
};
|
};
|
||||||
let #op_state_name = &mut ctx.state.borrow_mut();
|
let #op_state_name = &mut std::cell::RefCell::borrow_mut(&ctx.state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
quote! {}
|
quote! {}
|
||||||
|
@ -542,7 +542,7 @@ fn codegen_v8_sync(
|
||||||
let fast_error_handler = if has_fallible_fast_call {
|
let fast_error_handler = if has_fallible_fast_call {
|
||||||
quote! {
|
quote! {
|
||||||
{
|
{
|
||||||
let op_state = &mut ctx.state.borrow_mut();
|
let op_state = &mut std::cell::RefCell::borrow_mut(&ctx.state);
|
||||||
if let Some(err) = op_state.last_fast_op_error.take() {
|
if let Some(err) = op_state.last_fast_op_error.take() {
|
||||||
let exception = #core::error::to_v8_error(scope, op_state.get_error_class_fn, &err);
|
let exception = #core::error::to_v8_error(scope, op_state.get_error_class_fn, &err);
|
||||||
scope.throw_exception(exception);
|
scope.throw_exception(exception);
|
||||||
|
|
Loading…
Add table
Reference in a new issue