feat(selfhost): HirNode.sourceFile for mid-function #line maps

Stamp each HIR node with Decl source path; C backend tracks lastDebugFile
so #line re-emits when file or line changes. Closures inherit the
enclosing function path. Smoke checks Util_Double body maps to Util.bux.
This commit is contained in:
2026-07-19 23:40:10 +03:00
parent 200adf4d68
commit c82757d51c
5 changed files with 113 additions and 13 deletions
+4 -1
View File
@@ -66,6 +66,9 @@ module Hir {
// Extra data pointer (for children arrays, field lists, etc.)
extraData: *void;
extraCount: int;
// Per-node source path for #line (multi-file / rare mid-function spans)
// Empty → C backend falls back to HirFunc.sourceFile / currentFile
sourceFile: String;
}
// ---------------------------------------------------------------------------
@@ -182,7 +185,7 @@ module Hir {
typeKind: 0, typeName: "",
strValue: "", intValue: 0, boolValue: false,
child1: null as *HirNode, child2: null as *HirNode, child3: null as *HirNode,
extraData: null as *void, extraCount: 0 };
extraData: null as *void, extraCount: 0, sourceFile: "" };
}
func Hir_MakeLit(tokKind: int, tokText: String, line: uint32, col: uint32) -> HirNode {