Files
five/compiler/gengo
Charles KWON OhJun 48bebda687 fix(gengo): hoist every BEGINDUMP-supplied import, not just fmt/strings
doGenerate's deferred-imports patch handled only "fmt" and "strings"
— enough for inline RTL but a dead end for #pragma BEGINDUMP blocks
that import third-party / private packages (e.g. solmade's
internal/dartapi). hoistGoImports() registered every imported path
in g.imports correctly, but the final placeholder replacement never
emitted them, so the generated .go file's import block stayed
incomplete and `go build` failed with "undefined: dartapi".

Now every entry of g.imports that isn't already in the header gets
appended to the DEFERRED_IMPORTS substitution. Sorted output for
stable diffs.

Verified: a 4-line BEGINDUMP block in /tmp/poc_dartapi.prg that
imports "encoding/json" + "gitea.fivego.org/kwon_ai/solmade/internal/dartapi"
now compiles into a single 23 MB binary that calls
dartapi.AllAliases() at run time and returns the real count (3).
Full Five regression: go test compiler/, compat 56/56, std.ch 17/17,
FRB 7/7 all pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 14:33:20 +09:00
..