lang: funcs: funcgen: Refactor slightly for list input
This code had some design issues. We'll rewrite this eventually, but for now, let's allow list inputs. Refactor this to make it possible.
This commit is contained in:
@@ -68,8 +68,9 @@ func (obj *arg) ToMcl() (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// ToGo prints the arg signature as expected by golang.
|
||||
func (obj *arg) ToGolang() (string, error) {
|
||||
// OldToGolang prints the arg signature as expected by golang. This is only used
|
||||
// for returns.
|
||||
func (obj *arg) OldToGolang() (string, error) {
|
||||
switch obj.Type {
|
||||
case "bool":
|
||||
return "Bool", nil
|
||||
@@ -79,6 +80,8 @@ func (obj *arg) ToGolang() (string, error) {
|
||||
return "Int", nil
|
||||
case "float64":
|
||||
return "Float", nil
|
||||
//case "[]string":
|
||||
// XXX: Lists don't fit well with this code design. Refactor!
|
||||
default:
|
||||
return "", fmt.Errorf("cannot convert %v to golang", obj)
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ func (obj *function) Signature() (string, error) {
|
||||
|
||||
// MakeGoReturn returns the golang signature of the return.
|
||||
func (obj *function) MakeGoReturn() (string, error) {
|
||||
return obj.Return[0].ToGolang()
|
||||
return obj.Return[0].OldToGolang()
|
||||
}
|
||||
|
||||
// ConvertStart returns the start of a casting function required to convert from
|
||||
|
||||
Reference in New Issue
Block a user