mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
JSSpecCompiler: Replace all declarations with assignments
We assume that variable shadowing is impossible, so then there is no reason to keep distinct Declaration and Assignment operators after ReferenceResolvingPass.
This commit is contained in:
parent
12072dbac5
commit
23164bc570
2 changed files with 22 additions and 20 deletions
|
@ -18,6 +18,8 @@ RecursionDecision ReferenceResolvingPass::on_entry(Tree tree)
|
|||
if (binary_operation->m_operation != BinaryOperator::Declaration)
|
||||
return RecursionDecision::Recurse;
|
||||
|
||||
binary_operation->m_operation = BinaryOperator::Assignment;
|
||||
|
||||
if (auto variable_name = as<UnresolvedReference>(binary_operation->m_left); variable_name) {
|
||||
auto name = variable_name->m_name;
|
||||
if (!m_function->m_local_variables.contains(name))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue