From 5c2520e6b2b2046005de427f515afa8b49c269b7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 22 Oct 2020 17:23:40 +0200 Subject: [PATCH] LibJS: Simplify environment access a little bit in VM::construct() --- Libraries/LibJS/Runtime/VM.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Libraries/LibJS/Runtime/VM.cpp b/Libraries/LibJS/Runtime/VM.cpp index bc515d0034..d53e4dd79f 100644 --- a/Libraries/LibJS/Runtime/VM.cpp +++ b/Libraries/LibJS/Runtime/VM.cpp @@ -198,13 +198,12 @@ Value VM::construct(Function& function, Function& new_target, Optionalset_new_target(&new_target); + call_frame.environment->set_new_target(&new_target); Object* new_object = nullptr; if (function.constructor_kind() == Function::ConstructorKind::Base) { new_object = Object::create_empty(global_object); - current_environment()->bind_this_value(global_object, new_object); + call_frame.environment->bind_this_value(global_object, new_object); if (exception()) return {}; auto prototype = new_target.get(names.prototype); @@ -222,7 +221,7 @@ Value VM::construct(Function& function, Function& new_target, Optionalget_this_binding(global_object); + this_value = call_frame.environment->get_this_binding(global_object); pop_call_frame(); call_frame_popper.disarm();