Files
zeekayandClaude Opus 5 2c2f0e6bf3 Go 1.27.1, and the code it can say more simply
Modules declare go 1.27.1 and the build images follow. go fix applied the
modernizers, and the interpreter's parseArg, evaluateExprAs and
evaluateOptExprAs are now generic methods on the parser and program state
they take. omitzero is not applied, since it changes what the JSON says.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-16 19:52:45 -07:00

39 lines
871 B
Go

package interpreter
import (
"github.com/formancehq/numscript/internal/parser"
"github.com/formancehq/numscript/internal/utils"
)
func setTxMeta(st *programState, r parser.Range, args []Value) InterpreterError {
p := NewArgsParser(args)
key := p.parseArg(r, expectString)
meta := p.parseArg(r, expectAnything)
err := p.parse()
if err != nil {
return err
}
st.TxMeta[*key] = *meta
return nil
}
func setAccountMeta(st *programState, r parser.Range, args []Value) InterpreterError {
p := NewArgsParser(args)
account := p.parseArg(r, expectAccount)
key := p.parseArg(r, expectString)
meta := p.parseArg(r, expectAnything)
err := p.parse()
if err != nil {
return err
}
accountMeta := utils.MapGetOrPutDefault(st.SetAccountsMeta, *account, func() AccountMetadata {
return AccountMetadata{}
})
accountMeta[*key] = (*meta).String()
return nil
}