feat(selfhost): field-move skip Drop, #line maps, Array field mono

Bring selfhost C backend closer to bootstrap ownership and debug quality.

- Mark locals moved into struct fields / returns (no double Drop)
- Mangle Array/Set/Map/Channel field types so user structs fully emit
- Emit #line N from HIR line; BUX_DEBUG_FILE / BUX_NO_LINE controls
This commit is contained in:
2026-07-19 23:07:01 +03:00
parent cfb89dd72f
commit 94cc94f638
4 changed files with 148 additions and 28 deletions
+12 -1
View File
@@ -4073,7 +4073,18 @@ module HirLower {
hm.structs[si].fields[fi].typeName = String_Concat(ftype.pointerPointee.typeName, "*");
}
} else if !String_Eq(ftype.typeName, "") {
hm.structs[si].fields[fi].typeName = ftype.typeName;
// Monomorphize container fields: Array<int> → Array_int
// so C backend does not skip the parent struct as "generic".
var tn: String = ftype.typeName;
if ftype.typeArgCount >= 1 && !String_Eq(ftype.typeArgName0, "") {
if String_Eq(tn, "Array") || String_Eq(tn, "Set") ||
String_Eq(tn, "Channel") || String_Eq(tn, "Iter") {
tn = String_Concat(String_Concat(tn, "_"), ftype.typeArgName0);
} else if String_Eq(tn, "Map") && ftype.typeArgCount >= 2 {
tn = String_Concat(String_Concat(String_Concat("Map_", ftype.typeArgName0), "_"), ftype.typeArgName1);
}
}
hm.structs[si].fields[fi].typeName = tn;
}
}
fi = fi + 1;