mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 07:25:07 +00:00
LibJS: Remove unreachable code in Interpreter::enter_scope()
Functions are handled and short-circuited at the head of enter_scope().
This commit is contained in:
parent
9b9086dcf0
commit
13865c7c3d
1 changed files with 4 additions and 11 deletions
|
@ -125,17 +125,10 @@ void Interpreter::enter_scope(const ScopeNode& scope_node, ArgumentVector argume
|
||||||
|
|
||||||
bool pushed_lexical_environment = false;
|
bool pushed_lexical_environment = false;
|
||||||
|
|
||||||
if (scope_type != ScopeType::Function) {
|
if (!scope_variables_with_declaration_kind.is_empty()) {
|
||||||
// only a block, but maybe it has block-scoped variables!
|
auto* block_lexical_environment = heap().allocate<LexicalEnvironment>(move(scope_variables_with_declaration_kind), current_environment());
|
||||||
if (!scope_variables_with_declaration_kind.is_empty()) {
|
m_call_stack.last().environment = block_lexical_environment;
|
||||||
auto* block_lexical_environment = heap().allocate<LexicalEnvironment>(move(scope_variables_with_declaration_kind), current_environment());
|
pushed_lexical_environment = true;
|
||||||
m_call_stack.last().environment = block_lexical_environment;
|
|
||||||
pushed_lexical_environment = true;
|
|
||||||
}
|
|
||||||
} else if (scope_type == ScopeType::Function) {
|
|
||||||
for (auto& it : scope_variables_with_declaration_kind) {
|
|
||||||
current_environment()->set(it.key, it.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scope_stack.append({ scope_type, scope_node, pushed_lexical_environment });
|
m_scope_stack.append({ scope_type, scope_node, pushed_lexical_environment });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue