compileFunc: prevent compiling multiple times

This commit is contained in:
xushiwei
2024-05-05 21:27:22 +08:00
parent 2bbd828f3a
commit be9d209622
4 changed files with 80 additions and 79 deletions

View File

@@ -184,6 +184,11 @@ func (p Function) NewBuilder() Builder {
return &aBuilder{b, p, prog}
}
// HasBody reports whether the function has a body.
func (p Function) HasBody() bool {
return len(p.blks) > 0
}
// MakeBody creates nblk basic blocks for the function, and creates
// a new Builder associated to #0 block.
func (p Function) MakeBody(nblk int) Builder {