Skip to content

Commit

Permalink
gop/printer: static method
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Apr 9, 2024
1 parent 71af0f8 commit f810c74
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions printer/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2016,8 +2016,13 @@ func (p *printer) funcDecl(d *ast.FuncDecl) {
// FUNC is emitted).
startCol := p.out.Column - len("func ")
if d.Recv != nil && !d.IsClass {
p.parameters(d.Recv) // method: print receiver
p.print(blank)
if d.Static { // static method
p.expr(d.Recv.List[0].Type)
p.print(token.PERIOD)
} else {
p.parameters(d.Recv) // method: print receiver
p.print(blank)
}
}
p.expr(d.Name)
if d.Operator && d.Recv != nil {
Expand Down

0 comments on commit f810c74

Please sign in to comment.