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
commit 3aec6952a2
Notes: sideshowbarker 2024-07-16 21:42:29 +09:00
8 changed files with 46 additions and 24 deletions

View file

@ -120,8 +120,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
step.dump_cfg = true;
});
TranslationUnit translation_unit;
translation_unit.filename = filename;
TranslationUnit translation_unit(filename);
// Functions referenced in DifferenceISODate
// TODO: This is here just for testing. In a long run, we need some place, which is not
@ -139,14 +138,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (step.dump_ast) {
outln(stderr, "===== AST after {} =====", step.step->name());
for (auto const& function : translation_unit.functions_to_compile) {
for (auto const& function : translation_unit.functions_to_compile()) {
outln(stderr, "{}({}):", function->m_name, function->m_argument_names);
outln(stderr, "{}", function->m_ast);
}
}
if (step.dump_cfg && translation_unit.functions_to_compile[0]->m_cfg != nullptr) {
if (step.dump_cfg && translation_unit.functions_to_compile()[0]->m_cfg != nullptr) {
outln(stderr, "===== CFG after {} =====", step.step->name());
for (auto const& function : translation_unit.functions_to_compile) {
for (auto const& function : translation_unit.functions_to_compile()) {
outln(stderr, "{}({}):", function->m_name, function->m_argument_names);
outln(stderr, "{}", *function->m_cfg);
}