mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
Generate const annotations for pure methods
This commit is contained in:
1 parent
92ecd0a901
commit
e2d1f8e0c2
4 files changed
+33
-27
No files matched your search
@@ -115,6 +115,9 @@ func (g *gen) writeFuncSignature(b *buffer, n *a.Func, cpp uint32) error {
|
||||
comma := false
|
||||
if cpp == cppNone {
|
||||
if r := n.Receiver(); !r.IsZero() {
|
||||
if n.Effect().Pure() {
|
||||
b.writes("const ")
|
||||
}
|
||||
b.printf("%s%s *self", g.pkgPrefix, r.Str(g.tm))
|
||||
comma = true
|
||||
}
|
||||
@@ -132,6 +135,9 @@ func (g *gen) writeFuncSignature(b *buffer, n *a.Func, cpp uint32) error {
|
||||
}
|
||||
|
||||
b.printf(")")
|
||||
if cpp != cppNone && !n.Receiver().IsZero() && n.Effect().Pure() {
|
||||
b.writes(" const ")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user