Files
wazero/internal/wazeroir/format.go
2023-03-06 15:43:35 +09:00

24 lines
414 B
Go

package wazeroir
import (
"bytes"
)
const EntrypointLabel = ".entrypoint"
func Format(ops []Operation) string {
buf := bytes.NewBuffer(nil)
_, _ = buf.WriteString(EntrypointLabel + "\n")
for _, op := range ops {
str := op.String()
isLabel := op.Kind() == OperationKindLabel
if !isLabel {
const indent = "\t"
str = indent + str
}
_, _ = buf.WriteString(str + "\n")
}
return buf.String()
}