mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Add syntax support for implementing interfaces
This commit is contained in:
1 parent
8f5983f151
commit
ea54c2ea11
10 files changed
+249
-97
No files matched your search
+12
-3
@@ -314,11 +314,20 @@ func (h *genHelper) genWuffs(dirname string, qualifiedFilenames []string) error
|
||||
if !n.Public() {
|
||||
continue
|
||||
}
|
||||
classy := ""
|
||||
fmt.Fprintf(out, "pub struct %s", n.QID().Str(&h.tm))
|
||||
if n.Classy() {
|
||||
classy = "?"
|
||||
fmt.Fprintf(out, "?")
|
||||
}
|
||||
fmt.Fprintf(out, "pub struct %s%s()\n", n.QID().Str(&h.tm), classy)
|
||||
if imps := n.Implements(); len(imps) > 0 {
|
||||
fmt.Fprintf(out, " implements ")
|
||||
for i, imp := range imps {
|
||||
if i > 0 {
|
||||
fmt.Fprintf(out, ", ")
|
||||
}
|
||||
fmt.Fprintf(out, "%s", imp.AsTypeExpr().Str(&h.tm))
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(out, "()\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user