lang: Functions that build should be copyable

It's not entirely clear if this is required, but it's probably a good
idea. We should consider making it a requirement of the BuildableFunc
interface.
This commit is contained in:
James Shubin
2025-04-19 21:21:19 -04:00
parent 1bb1e056c4
commit 1536a94026
10 changed files with 112 additions and 0 deletions

View File

@@ -354,6 +354,16 @@ func (obj *PrintfFunc) Stream(ctx context.Context) error {
}
}
// Copy is implemented so that the obj.Type value is not lost if we copy this
// function.
func (obj *PrintfFunc) Copy() interfaces.Func {
return &PrintfFunc{
Type: obj.Type, // don't copy because we use this after unification
init: obj.init, // likely gets overwritten anyways
}
}
// Call this function with the input args and return the value if it is possible
// to do so at this time.
func (obj *PrintfFunc) Call(ctx context.Context, args []types.Value) (types.Value, error) {