Skip to content

Commit

Permalink
fixup: merge eval_env with env
Browse files Browse the repository at this point in the history
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
  • Loading branch information
daeyeon committed Jul 8, 2022
1 parent ff52370 commit 06a97fd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,6 @@ void ContextifyScript::RunInContext(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsObject() || args[0]->IsNull());

Local<Context> context;
Environment* eval_env = nullptr;
std::shared_ptr<v8::MicrotaskQueue> microtask_queue;

if (args[0]->IsObject()) {
Expand All @@ -861,14 +860,13 @@ void ContextifyScript::RunInContext(const FunctionCallbackInfo<Value>& args) {
ContextifyContext* contextify_context =
ContextifyContext::ContextFromContextifiedSandbox(env, sandbox);
CHECK_NOT_NULL(contextify_context);
CHECK_EQ(contextify_context->env(), env);

context = contextify_context->context();
if (context.IsEmpty()) return;

eval_env = contextify_context->env();
microtask_queue = contextify_context->microtask_queue();
} else {
eval_env = env;
context = env->context();
}

Expand All @@ -888,7 +886,7 @@ void ContextifyScript::RunInContext(const FunctionCallbackInfo<Value>& args) {

// Do the eval within the context
Context::Scope context_scope(context);
EvalMachine(eval_env,
EvalMachine(env,
timeout,
display_errors,
break_on_sigint,
Expand Down

0 comments on commit 06a97fd

Please sign in to comment.