Files
wazero/internal/wazeroir/format.go
2023-04-05 09:38:49 +09:00

25 lines
429 B
Go

package wazeroir
import (
"bytes"
)
const EntrypointLabel = ".entrypoint"
func Format(ops []UnionOperation) string {
buf := bytes.NewBuffer(nil)
_, _ = buf.WriteString(EntrypointLabel + "\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()
}