1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibJS: Remove unused delete_variable method in VM

This commit is contained in:
davidot 2021-09-18 01:59:49 +02:00 committed by Linus Groh
parent e6a97f1b7b
commit 53cc7e8398
2 changed files with 0 additions and 24 deletions

View file

@ -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<Variable> 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);