From 199654f5522f2c2dc86a3d8ddfe6fba378b917b5 Mon Sep 17 00:00:00 2001 From: mappu Date: Fri, 10 Apr 2020 20:07:45 +1200 Subject: [PATCH] node: make sure transferred comments do not comment out legitimate source lines(!) --- node.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node.go b/node.go index cf95856..82d3fb9 100644 --- a/node.go +++ b/node.go @@ -93,6 +93,10 @@ func (this *conversionState) convert(n node.Node) (string, error) { return "", err } + if len(freePrefix) > 0 && !(strings.HasSuffix(freePrefix, "\n") || strings.HasSuffix(freePrefix, `*/`)) { + freePrefix += "\n" + } + return freePrefix + ret + freeSuffix, nil }