node: fix panic in explode/implode parameter reordering

This commit is contained in:
mappu 2020-04-11 13:11:07 +12:00
parent b2ef112f50
commit 1188a769ce

View File

@ -1010,7 +1010,7 @@ func (this *conversionState) convertNoFreeFloating(n_ node.Node) (string, error)
}
this.importPackages["strings"] = struct{}{}
funcName = `strings.Split`
callParams[0], callParams[1] = callParams[1], callParams[2] // need to reverse function argument order
callParams[0], callParams[1] = callParams[1], callParams[0] // need to reverse function argument order
} else if funcName == `implode` {
if len(callParams) != 2 {
@ -1019,7 +1019,7 @@ func (this *conversionState) convertNoFreeFloating(n_ node.Node) (string, error)
this.importPackages["strings"] = struct{}{}
funcName = `strings.Join`
callParams[0], callParams[1] = callParams[1], callParams[2] // need to reverse function argument order
callParams[0], callParams[1] = callParams[1], callParams[0] // need to reverse function argument order
}