Skip to content

Commit

Permalink
WIP: integrate TryCatch
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Jun 25, 2020
1 parent dc62bfb commit 464602e
Show file tree
Hide file tree
Showing 10 changed files with 676 additions and 580 deletions.
4 changes: 2 additions & 2 deletions src/exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ impl Exception {
message: Local<String>,
contructor: unsafe extern "C" fn(*const String) -> *const Value,
) -> Local<'s, Value> {
scope.get_isolate_mut().enter();
scope.enter_isolate();
let error =
unsafe { scope.cast_local(|_| (contructor)(&*message)) }.unwrap();
scope.get_isolate_mut().exit();
scope.exit_isolate();
error
}

Expand Down
4 changes: 2 additions & 2 deletions src/isolate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl Isolate {
/// Sets this isolate as the entered one for the current thread.
/// Saves the previously entered one (if any), so that it can be
/// restored when exiting. Re-entering an isolate is allowed.
pub(crate) fn enter(&mut self) {
pub(crate) fn enter_isolate(&mut self) {
unsafe { v8__Isolate__Enter(self) }
}

Expand All @@ -285,7 +285,7 @@ impl Isolate {
/// entered more than once.
///
/// Requires: self == Isolate::GetCurrent().
pub(crate) fn exit(&mut self) {
pub(crate) fn exit_isolate(&mut self) {
unsafe { v8__Isolate__Exit(self) }
}

Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ mod snapshot;
mod string;
mod support;
mod template;
mod try_catch;
mod uint8_array;
mod value;

Expand Down Expand Up @@ -105,6 +104,7 @@ pub use scope::CallbackScope;
pub use scope::ContextScope;
pub use scope::EscapableHandleScope;
pub use scope::HandleScope;
pub use scope::TryCatch;
pub use script::ScriptOrigin;
pub use snapshot::FunctionCodeHandling;
pub use snapshot::SnapshotCreator;
Expand All @@ -115,7 +115,6 @@ pub use support::SharedRef;
pub use support::UniquePtr;
pub use support::UniqueRef;
pub use template::*;
pub use try_catch::{TryCatch, TryCatchScope};

// TODO(piscisaureus): Ideally this trait would not be exported.
pub use support::MapFnTo;
Loading

0 comments on commit 464602e

Please sign in to comment.