MCPcopy
hub / github.com/MadAppGang/dingo / SafeNavCodeGen

Struct SafeNavCodeGen

pkg/codegen/safe_nav.go:41–46  ·  view source on GitHub ↗

SafeNavCodeGen generates Go code for safe navigation expressions. With context (human-like output): return config?.Database?.Host → if config != nil && config.Database != nil { return config.Database.Host } return nil Without context (IIFE fallback): config?.Database?.Host → func() in

Source from the content-addressed store, hash-verified

39//
40// This avoids duplicate receiver evaluation and ensures correct type inference.
41type SafeNavCodeGen struct {
42 *BaseGenerator
43 expr *ast.SafeNavExpr
44 callExpr *ast.SafeNavCallExpr
45 Context *GenContext // Optional context for human-like code generation
46}
47
48// NewSafeNavGenerator creates a SafeNavCodeGen for field access (x?.field)
49func NewSafeNavGenerator(expr *ast.SafeNavExpr) *SafeNavCodeGen {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected