File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package build
22
33import (
44 "errors"
5+ "fmt"
56 "go/types"
67
78 "github.com/mmcloughlin/avo/attr"
@@ -138,6 +139,11 @@ func (c *Context) Comment(lines ...string) {
138139 c .activefunc ().AddComment (lines ... )
139140}
140141
142+ // Commentf adds a formtted comment line.
143+ func (c * Context ) Commentf (format string , a ... interface {}) {
144+ c .Comment (fmt .Sprintf (format , a ... ))
145+ }
146+
141147func (c * Context ) activefunc () * ir.Function {
142148 if c .function == nil {
143149 c .adderrormessage ("no active function" )
Original file line number Diff line number Diff line change @@ -128,5 +128,8 @@ func Label(name string) { ctx.Label(name) }
128128// Comment adds comment lines to the active function.
129129func Comment (lines ... string ) { ctx .Comment (lines ... ) }
130130
131+ // Commentf adds a formtted comment line.
132+ func Commentf (format string , a ... interface {}) { ctx .Commentf (format , a ... ) }
133+
131134// ConstData builds a static data section containing just the given constant.
132135func ConstData (name string , v operand.Constant ) operand.Mem { return ctx .ConstData (name , v ) }
You can’t perform that action at this time.
0 commit comments