From 53cc7e839868e61af3d24e03e044c1048d5ecde0 Mon Sep 17 00:00:00 2001 From: davidot Date: Sat, 18 Sep 2021 01:59:49 +0200 Subject: [PATCH] LibJS: Remove unused delete_variable method in VM --- Userland/Libraries/LibJS/Runtime/VM.cpp | 23 ----------------------- Userland/Libraries/LibJS/Runtime/VM.h | 1 - 2 files changed, 24 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index a5ec997946..b98969b86c 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -168,29 +168,6 @@ void VM::set_variable(const FlyString& name, Value value, GlobalObject& global_o global_object.set(name, value, Object::ShouldThrowExceptions::Yes); } -bool VM::delete_variable(FlyString const& name) -{ - Environment* specific_scope = nullptr; - Optional possible_match; - if (!m_execution_context_stack.is_empty()) { - for (auto* environment = lexical_environment(); environment; environment = environment->outer_environment()) { - possible_match = environment->get_from_environment(name); - if (possible_match.has_value()) { - specific_scope = environment; - break; - } - } - } - - if (!possible_match.has_value()) - return false; - if (possible_match.value().declaration_kind == DeclarationKind::Const) - return false; - - VERIFY(specific_scope); - return specific_scope->delete_from_environment(name); -} - void VM::assign(const FlyString& target, Value value, GlobalObject& global_object, bool first_assignment, Environment* specific_scope) { set_variable(target, move(value), global_object, first_assignment, specific_scope); diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 0bd7d9a714..4fb53f1967 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -206,7 +206,6 @@ public: Value get_variable(const FlyString& name, GlobalObject&); void set_variable(const FlyString& name, Value, GlobalObject&, bool first_assignment = false, Environment* specific_scope = nullptr); - bool delete_variable(FlyString const& name); void assign(const Variant, NonnullRefPtr>& target, Value, GlobalObject&, bool first_assignment = false, Environment* specific_scope = nullptr); void assign(const FlyString& target, Value, GlobalObject&, bool first_assignment = false, Environment* specific_scope = nullptr); void assign(const NonnullRefPtr& target, Value, GlobalObject&, bool first_assignment = false, Environment* specific_scope = nullptr);