aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/printer.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-01-08 10:29:11 -0800
committerRobert Griesemer <gri@golang.org>2021-01-08 22:00:23 +0000
commit822aeacd9ed0630f84552d3120a12ddaa65b23cc (patch)
tree59c9f533e65a9f6ef3189fb72736e6d7b4308ff3 /src/cmd/compile/internal/syntax/printer.go
parentd017a1b64951d43b009c18454443025cbc9373e1 (diff)
downloadgo-822aeacd9ed0630f84552d3120a12ddaa65b23cc.tar.gz
go-822aeacd9ed0630f84552d3120a12ddaa65b23cc.zip
[dev.typeparams] cmd/compile/internal/syntax: remove ShortString, use String instead
Follow-up on feedback by mdempsky@ in https://golang.org/cl/282552 . Change-Id: I1e5bb2d67cc8ae29fed100b87d18a33b3e2069eb Reviewed-on: https://go-review.googlesource.com/c/go/+/282672 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/syntax/printer.go')
-rw-r--r--src/cmd/compile/internal/syntax/printer.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/syntax/printer.go b/src/cmd/compile/internal/syntax/printer.go
index 0a60e1753d..161eb0d092 100644
--- a/src/cmd/compile/internal/syntax/printer.go
+++ b/src/cmd/compile/internal/syntax/printer.go
@@ -44,20 +44,17 @@ func Fprint(w io.Writer, x Node, form Form) (n int, err error) {
return
}
-func asString(n Node, form Form) string {
+// String is a convenience functions that prints n in ShortForm
+// and returns the printed string.
+func String(n Node) string {
var buf bytes.Buffer
- _, err := Fprint(&buf, n, form)
+ _, err := Fprint(&buf, n, ShortForm)
if err != nil {
fmt.Fprintf(&buf, "<<< ERROR: %s", err)
}
return buf.String()
}
-// String and ShortString are convenience functions that print n in
-// LineForm or ShortForm respectively, and return the printed string.
-func String(n Node) string { return asString(n, LineForm) }
-func ShortString(n Node) string { return asString(n, ShortForm) }
-
type ctrlSymbol int
const (