summaryrefslogtreecommitdiff
path: root/vendor/github.com/tetratelabs/wazero/internal/engine/interpreter/format.go
blob: 8af1d94b0cff214d508c573101bfab112c0a3011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package interpreter

import (
	"bytes"
)

func format(ops []unionOperation) string {
	buf := bytes.NewBuffer(nil)

	_, _ = buf.WriteString(".entrypoint\n")
	for i := range ops {
		op := &ops[i]
		str := op.String()
		isLabel := op.Kind == operationKindLabel
		if !isLabel {
			const indent = "\t"
			str = indent + str
		}
		_, _ = buf.WriteString(str + "\n")
	}
	return buf.String()
}