github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/engine/interpreter/format.go (about)

     1  package interpreter
     2  
     3  import (
     4  	"bytes"
     5  )
     6  
     7  func format(ops []unionOperation) string {
     8  	buf := bytes.NewBuffer(nil)
     9  
    10  	_, _ = buf.WriteString(".entrypoint\n")
    11  	for i := range ops {
    12  		op := &ops[i]
    13  		str := op.String()
    14  		isLabel := op.Kind == operationKindLabel
    15  		if !isLabel {
    16  			const indent = "\t"
    17  			str = indent + str
    18  		}
    19  		_, _ = buf.WriteString(str + "\n")
    20  	}
    21  	return buf.String()
    22  }