feat(selfhost): multi-file #line paths from Decl.sourceFile

Stamp each merged .bux path onto decls, propagate to HirFunc, and emit
#line N \"path\" per function without requiring BUX_DEBUG_FILE.

- Decl.sourceFile + Cli_StampSourceFile on merge/project parse
- HirFunc.sourceFile; CBE switches currentFile per function
- Stdlib and multi-file user packages get distinct paths automatically
This commit is contained in:
2026-07-19 23:13:02 +03:00
parent ed07cf8921
commit 70321075a6
7 changed files with 75 additions and 10 deletions
+5 -4
View File
@@ -148,13 +148,14 @@ make bench-nexus # wrk throughput vs apps/nexus /api/health
```bash
./buxc build # -O0 -g, #line → .bux (gdb-friendly; bootstrap)
./buxc build --release # -O2 -DNDEBUG, no #line / -g
# Selfhost (buxc2): same --release / default -O0 -g; #line via HIR line numbers
export BUX_DEBUG_FILE=src/Main.bux # path embedded in #line (selfhost)
# Selfhost (buxc2): default -O0 -g; multi-file #line from Decl.sourceFile
# (stdlib + each src/*.bux get their own path — no env needed)
export BUX_NO_LINE=1 # disable selfhost #line maps
export BUX_CFLAGS="-fno-omit-frame-pointer" # optional extra cc flags
export BUX_DEBUG_FILE=/abs/path.bux # optional: force all #line to one path
export BUX_CFLAGS="-fno-omit-frame-pointer"
gdb --args ./build/myapp
# (gdb) break Main
# (gdb) list # Bux source via #line
# (gdb) list # Bux source via #line (correct file per function)
```
+19 -5
View File
@@ -1,7 +1,7 @@
# Bux — План към „добър“ език (v0.5 → v1.0)
> **Дата:** 2026-07-19
> **Текущо:** v0.5.x — field-move, selfhost #line, Nexus KA, **LSP 0.8 call hierarchy**
> **Текущо:** v0.5.x — field-move, **multi-file #line**, Nexus KA, LSP 0.8 call hierarchy
> **Цел:** Език, с който се пишат реални проекти комфортно, безопасно (по избор) и с надежден toolchain.
---
@@ -78,7 +78,7 @@
| # | Задача | Защо | Статус |
|---|--------|------|--------|
| D.1 | LSP: hover, go-to-def, diagnostics | IDE = adoption | ✅ v0.7.0: + **field/variant rename** + workspace/symbol |
| D.1 | LSP: hover, go-to-def, diagnostics | IDE = adoption | ✅ v0.8.0: + **call hierarchy** + deeper rename + workspace/symbol |
| D.2 | `bux fmt` стабилен + CI check | Единен style | ✅ full-tree format + `make fmt-check` enforce |
| D.3 | `bux test` с `--filter`, exit codes, summary table | CI-friendly | ✅ `--filter` / summary / exit 0\|1 |
| D.4 | `bux doc` от `///` comments | Самодокументиращ се stdlib | ✅ bootstrap+selfhost + `make docs` |
@@ -642,9 +642,23 @@ A (stdlib ergonomics) → B (compiler holes) → C (ownership depth)
---
## Сесия 40 (LSP 0.8 call hierarchy)
1. **Providers:**
- `textDocument/prepareCallHierarchy`
- `callHierarchy/incomingCalls` — who calls F
- `callHierarchy/outgoingCalls` — what F calls
2. **Graph:** textual scan of known `func` symbols + `Name(` call sites;
enclosing function via nearest prior `func` decl line
3. Skips the declaration itself; workspace disk scan for other `.bux` files
4. Smoke: `tools/smoke_lsp_call_hierarchy.sh` (Add ← Compute; Compute → Add/Mul)
5. Version **bux-lsp 0.8.0**; `make test-lsp`
---
## Следващи стъпки
1. LSP call hierarchy (optional)
2. Selfhost multi-file `#line` paths without BUX_DEBUG_FILE
3. Wire selfhost smoke for move_field into CI
1. Selfhost multi-file `#line` paths without BUX_DEBUG_FILE
2. Wire selfhost smoke for move_field into CI
3. Method call hierarchy (receiver methods / interface dispatch)
4. Rename of method receivers / qualified module paths (edge cases)