1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

JSSpecCompiler: Make TranslationUnit fields private

For some reason I was afraid to add trivial accessors to classes
in earlier PRs, so we now have dozens of classes with public fields. I'm
not exactly looking forward to refactoring them all at once but I'll
do so gradually.
This commit is contained in:
Dan Klishch 2024-01-18 21:08:50 -05:00 committed by Andrew Kaster
parent a2f7849238
commit 3aec6952a2
8 changed files with 46 additions and 24 deletions

View file

@ -38,8 +38,6 @@ RecursionDecision ReferenceResolvingPass::on_entry(Tree tree)
void ReferenceResolvingPass::on_leave(Tree tree)
{
auto& functions = m_function->m_translation_unit->function_index;
if (auto reference = as<UnresolvedReference>(tree); reference) {
auto name = reference->m_name;
@ -53,8 +51,8 @@ void ReferenceResolvingPass::on_leave(Tree tree)
return;
}
if (auto it = functions.find(name); it != functions.end()) {
replace_current_node_with(make_ref_counted<FunctionPointer>(it->value));
if (auto function = m_translation_unit->find_declaration_by_name(name)) {
replace_current_node_with(make_ref_counted<FunctionPointer>(function));
return;
}
}