node: simplify some substr->slice expressions

This commit is contained in:
mappu 2020-04-16 18:55:27 +12:00
parent 23e06f517c
commit c29a4894ce

View File

@ -1254,6 +1254,10 @@ func (this *conversionState) convertNoFreeFloating(n_ node.Node) (string, error)
} else if len(callParams) == 3 {
// if lnum, ok := n.ArgumentList.Arguments[1].
if callParams[1] == `0` {
return "(" + callParams[0] + ")[:" + callParams[2] + "]", nil
}
// WARNING: We are doubling up on the first parameter
// This is a problem if it's not necessarily constant