lang: interfaces: Nil input means no args
This commit is contained in:
@@ -391,8 +391,9 @@ type Txn interface {
|
|||||||
// StructToCallableArgs transforms the single value, graph representation of the
|
// StructToCallableArgs transforms the single value, graph representation of the
|
||||||
// callable values into a linear, standard args list.
|
// callable values into a linear, standard args list.
|
||||||
func StructToCallableArgs(st types.Value) ([]types.Value, error) {
|
func StructToCallableArgs(st types.Value) ([]types.Value, error) {
|
||||||
if st == nil {
|
args := []types.Value{}
|
||||||
return nil, fmt.Errorf("empty struct")
|
if st == nil { // for functions that take no args
|
||||||
|
return args, nil
|
||||||
}
|
}
|
||||||
typ := st.Type()
|
typ := st.Type()
|
||||||
if typ == nil {
|
if typ == nil {
|
||||||
@@ -406,7 +407,6 @@ func StructToCallableArgs(st types.Value) ([]types.Value, error) {
|
|||||||
return nil, fmt.Errorf("empty values")
|
return nil, fmt.Errorf("empty values")
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []types.Value{}
|
|
||||||
for i, x := range typ.Ord { // in the correct order
|
for i, x := range typ.Ord { // in the correct order
|
||||||
v, exists := structValues[x]
|
v, exists := structValues[x]
|
||||||
if !exists {
|
if !exists {
|
||||||
|
|||||||
Reference in New Issue
Block a user