summaryrefslogtreecommitdiff
path: root/ops
diff options
context:
space:
mode:
Diffstat (limited to 'ops')
-rw-r--r--ops/Cargo.toml1
-rw-r--r--ops/lib.rs7
-rw-r--r--ops/optimizer.rs1
-rw-r--r--ops/optimizer_tests/async_nop.out5
-rw-r--r--ops/optimizer_tests/async_result.out5
-rw-r--r--ops/optimizer_tests/issue16934.out5
-rw-r--r--ops/optimizer_tests/issue16934_fast.out5
7 files changed, 24 insertions, 5 deletions
diff --git a/ops/Cargo.toml b/ops/Cargo.toml
index b8bbfd07d..42ce3b485 100644
--- a/ops/Cargo.toml
+++ b/ops/Cargo.toml
@@ -25,6 +25,7 @@ regex.workspace = true
syn.workspace = true
[dev-dependencies]
+pretty_assertions.workspace = true
prettyplease = "0.1.21"
testing_macros = "0.2.7"
trybuild = "1.0.71"
diff --git a/ops/lib.rs b/ops/lib.rs
index 41f69d9fc..7bf962091 100644
--- a/ops/lib.rs
+++ b/ops/lib.rs
@@ -319,11 +319,15 @@ fn codegen_v8_async(
};
#pre_result
- #core::_ops::queue_async_op(ctx, scope, #deferred, async move {
+ let maybe_response = #core::_ops::queue_async_op(ctx, scope, #deferred, async move {
let result = #result_fut
#result_wrapper
(realm_idx, promise_id, op_id, #core::_ops::to_op_result(get_class, result))
});
+
+ if let Some(response) = maybe_response {
+ rv.set(response);
+ }
}
}
@@ -901,6 +905,7 @@ fn exclude_lifetime_params(
mod tests {
use crate::Attributes;
use crate::Op;
+ use pretty_assertions::assert_eq;
use std::path::PathBuf;
#[testing_macros::fixture("optimizer_tests/**/*.rs")]
diff --git a/ops/optimizer.rs b/ops/optimizer.rs
index cc266c716..09d3d5be6 100644
--- a/ops/optimizer.rs
+++ b/ops/optimizer.rs
@@ -938,6 +938,7 @@ mod tests {
use super::*;
use crate::Attributes;
use crate::Op;
+ use pretty_assertions::assert_eq;
use std::path::PathBuf;
use syn::parse_quote;
diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out
index 5d73f2343..7782b5970 100644
--- a/ops/optimizer_tests/async_nop.out
+++ b/ops/optimizer_tests/async_nop.out
@@ -79,7 +79,7 @@ impl op_void_async {
state.tracker.track_async(op_id);
state.get_error_class_fn
};
- deno_core::_ops::queue_async_op(
+ let maybe_response = deno_core::_ops::queue_async_op(
ctx,
scope,
false,
@@ -94,6 +94,9 @@ impl op_void_async {
)
},
);
+ if let Some(response) = maybe_response {
+ rv.set(response);
+ }
}
}
#[allow(clippy::too_many_arguments)]
diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out
index f820687cd..c3bb433f1 100644
--- a/ops/optimizer_tests/async_result.out
+++ b/ops/optimizer_tests/async_result.out
@@ -90,7 +90,7 @@ impl op_async_result {
state.tracker.track_async(op_id);
state.get_error_class_fn
};
- deno_core::_ops::queue_async_op(
+ let maybe_response = deno_core::_ops::queue_async_op(
ctx,
scope,
false,
@@ -104,6 +104,9 @@ impl op_async_result {
)
},
);
+ if let Some(response) = maybe_response {
+ rv.set(response);
+ }
}
}
#[allow(clippy::too_many_arguments)]
diff --git a/ops/optimizer_tests/issue16934.out b/ops/optimizer_tests/issue16934.out
index f8acf5712..68f59ef43 100644
--- a/ops/optimizer_tests/issue16934.out
+++ b/ops/optimizer_tests/issue16934.out
@@ -84,7 +84,7 @@ impl send_stdin {
state.tracker.track_async(op_id);
state.get_error_class_fn
};
- deno_core::_ops::queue_async_op(
+ let maybe_response = deno_core::_ops::queue_async_op(
ctx,
scope,
false,
@@ -102,5 +102,8 @@ impl send_stdin {
)
},
);
+ if let Some(response) = maybe_response {
+ rv.set(response);
+ }
}
}
diff --git a/ops/optimizer_tests/issue16934_fast.out b/ops/optimizer_tests/issue16934_fast.out
index 0cdc3eb25..7a4a39f34 100644
--- a/ops/optimizer_tests/issue16934_fast.out
+++ b/ops/optimizer_tests/issue16934_fast.out
@@ -82,7 +82,7 @@ impl send_stdin {
state.tracker.track_async(op_id);
state.get_error_class_fn
};
- deno_core::_ops::queue_async_op(
+ let maybe_response = deno_core::_ops::queue_async_op(
ctx,
scope,
false,
@@ -100,5 +100,8 @@ impl send_stdin {
)
},
);
+ if let Some(response) = maybe_response {
+ rv.set(response);
+ }
}
}