From 8e84dc0139055db8c84ad28723114d343982a8f7 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Wed, 31 May 2023 08:19:06 -0600 Subject: chore(core): Split JsRuntimeForSnapshot from JsRuntime (#19308) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This cleans up `JsRuntime` a bit more: * We no longer print cargo's rerun-if-changed messages in `JsRuntime` -- those are printed elsewhere * We no longer special case the OwnedIsolate for snapshots. Instead we make use of an inner object that has the `Drop` impl and allows us to `std::mem::forget` it if we need to extract the isolate for a snapshot * The `snapshot` method is only available on `JsRuntimeForSnapshot`, not `JsRuntime`. * `OpState` construction is slightly cleaner, though I'd still like to extract more --------- Co-authored-by: Bartek IwaƄczuk --- core/error.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/error.rs') diff --git a/core/error.rs b/core/error.rs index 3d0b20b0a..16f813b89 100644 --- a/core/error.rs +++ b/core/error.rs @@ -209,7 +209,7 @@ impl JsStackFrame { let l = message.get_line_number(scope)? as i64; // V8's column numbers are 0-based, we want 1-based. let c = message.get_start_column() as i64 + 1; - let state_rc = JsRuntime::state(scope); + let state_rc = JsRuntime::state_from(scope); let (getter, cache) = { let state = state_rc.borrow(); ( @@ -282,7 +282,7 @@ impl JsError { frames = vec![stack_frame]; } { - let state_rc = JsRuntime::state(scope); + let state_rc = JsRuntime::state_from(scope); let (getter, cache) = { let state = state_rc.borrow(); ( @@ -414,7 +414,7 @@ impl JsError { } } { - let state_rc = JsRuntime::state(scope); + let state_rc = JsRuntime::state_from(scope); let (getter, cache) = { let state = state_rc.borrow(); ( -- cgit v1.2.3