Files
five/compiler/gengo
CharlesKWON 08ad6f4761 fix(gengo): unresolved identifiers fall back to PushMemvar, not PushLocal(0)
Three emitIdent / emitIdentByName / emitPopByName call sites used
`t.PushLocal(0)` as the fallback for compile-time-unresolved names
(missing #include constants, undeclared globals, typos). PushLocal(0)
crashes at runtime the moment that code path executes with "local
variable index out of range: 0" — even when the identifier is dead
code or behind a condition that's rarely true.

Concrete bugs this hid:
  - TSqlIndex:FindExclusive referenced DBI_FULLPATH / DBI_SHARED
    from a non-existent dbinfo.ch include. The 43-test harness only
    reached FindExclusive with no Used workareas, so the reference
    was never evaluated. Any standalone PRG that called five_SQL
    after dbUseArea would trip it.
  - Prior session's BindColumns/ResolveCache experiment hit the same
    class of crash in the CLASS Send path — diagnosed as "Unresolved
    → PushLocal(0)" at the time but root cause deferred.

Fix: use `t.PushMemvar(name)` / `t.PopMemvar(name)` instead. Matches
Harbour semantics (undefined identifiers try PRIVATE/PUBLIC memvar
tables at runtime, missing → NIL, assignment auto-creates PRIVATE).
Harbour is forgiving about unresolved names; Five now is too.

This doesn't silence the signal: the emitted comment still flags the
reference as unresolved for grep-ability in generated Go.

Validation:
  - FiveSql2 43/43
  - Harbour compat 51/51
  - go test ./... ALL PASS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 09:20:26 +09:00
..