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

@@ -454,3 +454,14 @@ func (obj *MapFunc) replaceSubGraph(subgraphInput interfaces.Func) error {
return obj.init.Txn.Commit()
}
// Copy is implemented so that the type values are not lost if we copy this
// function.
func (obj *MapFunc) Copy() interfaces.Func {
return &MapFunc{
Type: obj.Type, // don't copy because we use this after unification
RType: obj.RType, // don't copy because we use this after unification
init: obj.init, // likely gets overwritten anyways
}
}