From e1f41ed9fafaf7eb4f2da6878a3fabcf2f7c021e Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 09:13:32 +0000 Subject: feat(driver): compile multiple source files with INCLUDE visibility Reject builds without an entry program and duplicate cross-file definitions. Preserve source order for each unit's own constants and import visible exports. Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/Designator.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/CodeGen/Designator.cc') diff --git a/lib/CodeGen/Designator.cc b/lib/CodeGen/Designator.cc index 5f54a87..b31492b 100644 --- a/lib/CodeGen/Designator.cc +++ b/lib/CodeGen/Designator.cc @@ -11,10 +11,10 @@ using namespace cps; // (TYPE NodePtr = ^Node before TYPE Node — required for linked structures); // by-value record fields still require their record type to be complete, // which pass B's source order enforces. -void CodeGen::runTypePrePass(const std::vector> &Statements) { +void CodeGen::runTypePrePass(const std::vector> &Statements, int Phase) { std::string Err; - for (const auto &S : Statements) { + if (Phase == 0) for (const auto &S : Statements) { SaveAndRestore Location(DiagnosticLine, S->getLine()); bool Ok = true; if (auto *C = dynamic_cast(S.get())) @@ -29,7 +29,7 @@ void CodeGen::runTypePrePass(const std::vector> &Statem if (!Ok) reportError("%s", Err.c_str()); } - for (const auto &S : Statements) { + if (Phase == 1) for (const auto &S : Statements) { SaveAndRestore Location(DiagnosticLine, S->getLine()); bool Ok = true; if (auto *E = dynamic_cast(S.get())) { @@ -42,7 +42,7 @@ void CodeGen::runTypePrePass(const std::vector> &Statem if (!Ok) reportError("%s", Err.c_str()); } - for (const auto &S : Statements) { + if (Phase == 2) for (const auto &S : Statements) { auto *Class = dynamic_cast(S.get()); if (!Class) continue; auto &Methods = ClassMethods[Class->getName()]; -- cgit v1.3.1-4-g156e