From c29a4894ce6fdac624efda6db8dd1802b8756192 Mon Sep 17 00:00:00 2001 From: mappu Date: Thu, 16 Apr 2020 18:55:27 +1200 Subject: [PATCH] node: simplify some substr->slice expressions --- node.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node.go b/node.go index e5163ea..8315f77 100644 --- a/node.go +++ b/node.go @@ -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