mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
Replaces 100+ if/else-if chains on a single variable with tagged switch statements across 72 files. The bulk are transformer option-parsing loops (switch on opt string), plus a handful of value-dispatch sites in mlrval, dsl/cst, repl, lib, auxents, and bifs. One case (surv.go) required a labeled break to preserve the loop-exit behavior of the original else branch. Fixes staticcheck QF1003 findings. Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
13 lines
293 B
Go
13 lines
293 B
Go
package mlrval
|
|
|
|
// TODO: comment about mvtype; deferrence; copying of deferrence.
|
|
func (mv *Mlrval) Copy() *Mlrval {
|
|
other := *mv
|
|
switch mv.mvtype {
|
|
case MT_MAP:
|
|
other.intf = mv.intf.(*Mlrmap).Copy()
|
|
case MT_ARRAY:
|
|
other.intf = CopyMlrvalArray(mv.intf.([]*Mlrval))
|
|
}
|
|
return &other
|
|
}
|