Skip to content

Commit 7468f9e

Browse files
authored
Merge pull request #429 from xushiwei/q
pkg.NewFuncDecl doc
2 parents 0d40138 + 0126c40 commit 7468f9e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

func.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ func (p *Func) End(cb *CodeBuilder, src ast.Node) {
132132
}
133133
}
134134

135+
// NewFuncDecl creates a new function without function body (declaration only).
135136
func (p *Package) NewFuncDecl(pos token.Pos, name string, sig *types.Signature) *Func {
136137
f, err := p.NewFuncWith(pos, name, sig, nil)
137138
if err != nil {
@@ -142,7 +143,7 @@ func (p *Package) NewFuncDecl(pos token.Pos, name string, sig *types.Signature)
142143
return f
143144
}
144145

145-
// NewFunc func
146+
// NewFunc creates a new function (should have a function body).
146147
func (p *Package) NewFunc(recv *Param, name string, params, results *Tuple, variadic bool) *Func {
147148
sig := types.NewSignatureType(recv, nil, nil, params, results, variadic)
148149
f, err := p.NewFuncWith(token.NoPos, name, sig, nil)
@@ -159,7 +160,7 @@ func getRecv(recvTypePos func() token.Pos) token.Pos {
159160
return token.NoPos
160161
}
161162

162-
// NewFuncWith func
163+
// NewFuncWith creates a new function (should have a function body).
163164
func (p *Package) NewFuncWith(
164165
pos token.Pos, name string, sig *types.Signature, recvTypePos func() token.Pos) (*Func, error) {
165166
if name == "" {

0 commit comments

Comments
 (0)