selfhost: for x in collection works with non-identifier expressions + buxc2 build merges stdlib
- cli: buxc2 build now delegates to Cli_BuildProject for src/Main.bux,
enabling stdlib merging (Array_Iter, Iter_HasNext, etc. available)
- sema: set expr.refType on ekCall from function return type
(needed for for-loop type extraction from MakeArr()-style expressions)
- hir_lower: remove ekIdent restriction on collection-based for loops
- supports arbitrary expressions: for x in MakeArr() { ... }
- creates temp variable __tmp_coll_N for non-identifier iterators
- generates proper Array_T struct instances for temp variables
- Test: for x in MakeArr() sums [10,20,30] → 60
- Selfhost loop: C output IDENTICAL
This commit is contained in:
+11
@@ -114,6 +114,17 @@ func Cli_Compile(source: String, sourceName: String) -> String {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
func Cli_Build(srcPath: String, outPath: String) -> int {
|
||||
// If building the standard project entry point, use full project build
|
||||
// which merges stdlib and supports multi-file projects
|
||||
if String_Eq(srcPath, "src/Main.bux") || String_Eq(srcPath, "src/main.bux") {
|
||||
let rc: int = Cli_BuildProject(".");
|
||||
if rc == 0 && !String_Eq(outPath, "build/main") {
|
||||
// Rename output if custom path was requested
|
||||
bux_system(String_Concat(String_Concat("mv build/main ", outPath), " 2>/dev/null || true"));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
let source: String = ReadFile(srcPath);
|
||||
if source == null as String || String_Eq(source, "") || !FileExists(srcPath) {
|
||||
Print("Error: cannot read source file: ");
|
||||
|
||||
Reference in New Issue
Block a user