MCPcopy
hub / github.com/adonovan/gopl.io / Format

Function Format

ch7/eval/print.go:13–17  ·  view source on GitHub ↗

Format formats an expression as a string. It does not attempt to remove unnecessary parens.

(e Expr)

Source from the content-addressed store, hash-verified

11// Format formats an expression as a string.
12// It does not attempt to remove unnecessary parens.
13func Format(e Expr) string {
14 var buf bytes.Buffer
15 write(&buf, e)
16 return buf.String()
17}
18
19func write(buf *bytes.Buffer, e Expr) {
20 switch e := e.(type) {

Callers

nothing calls this directly

Calls 2

writeFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected