mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +01:00
Drop the "__pkg%08X" prefix in gen/wuffs code
This commit is contained in:
1 parent
7fb19d7669
commit
366a9388b3
1 file changed
+3
-11
+3
-11
@@ -25,7 +25,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/wuffs/lang/base38"
|
|
||||||
"github.com/google/wuffs/lang/generate"
|
"github.com/google/wuffs/lang/generate"
|
||||||
"github.com/google/wuffs/lang/parse"
|
"github.com/google/wuffs/lang/parse"
|
||||||
|
|
||||||
@@ -242,15 +241,10 @@ func (h *genHelper) genWuffs(dirname string, qualifiedFilenames []string) error
|
|||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("invalid packageid declaration")
|
return fmt.Errorf("invalid packageid declaration")
|
||||||
}
|
}
|
||||||
pkgIDNum, ok := base38.Encode(pkgIDStr)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("invalid packageid declaration")
|
|
||||||
}
|
|
||||||
prefix := fmt.Sprintf("__pkg%08X", pkgIDNum)
|
|
||||||
|
|
||||||
out := &bytes.Buffer{}
|
out := &bytes.Buffer{}
|
||||||
fmt.Fprintf(out, "// Code generated by running \"wuffs gen\". DO NOT EDIT.\n\n")
|
fmt.Fprintf(out, "// Code generated by running \"wuffs gen\". DO NOT EDIT.\n\n")
|
||||||
fmt.Fprintf(out, "packageid %q // %s\n\n", pkgIDStr, prefix)
|
fmt.Fprintf(out, "packageid %q\n\n", pkgIDStr)
|
||||||
|
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
for _, n := range f.TopLevelDecls() {
|
for _, n := range f.TopLevelDecls() {
|
||||||
@@ -270,8 +264,7 @@ func (h *genHelper) genWuffs(dirname string, qualifiedFilenames []string) error
|
|||||||
return fmt.Errorf("TODO: genWuffs for a free-standing function")
|
return fmt.Errorf("TODO: genWuffs for a free-standing function")
|
||||||
}
|
}
|
||||||
// TODO: look at n.Asserts().
|
// TODO: look at n.Asserts().
|
||||||
fmt.Fprintf(out, "pub func %s_%s.%s%s(",
|
fmt.Fprintf(out, "pub func %s.%s%s(", n.Receiver().Str(&h.tm), n.Name().Str(&h.tm), effect)
|
||||||
prefix, n.Receiver().Str(&h.tm), n.Name().Str(&h.tm), effect)
|
|
||||||
for i, param := range [2]*a.Struct{n.In(), n.Out()} {
|
for i, param := range [2]*a.Struct{n.In(), n.Out()} {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
fmt.Fprintf(out, ")(")
|
fmt.Fprintf(out, ")(")
|
||||||
@@ -293,7 +286,6 @@ func (h *genHelper) genWuffs(dirname string, qualifiedFilenames []string) error
|
|||||||
if !n.Public() {
|
if !n.Public() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// TODO: Qualify status names with the prefix somehow??
|
|
||||||
fmt.Fprintf(out, "pub %s %s\n", n.Keyword().Str(&h.tm), n.Message().Str(&h.tm))
|
fmt.Fprintf(out, "pub %s %s\n", n.Keyword().Str(&h.tm), n.Message().Str(&h.tm))
|
||||||
|
|
||||||
case a.KStruct:
|
case a.KStruct:
|
||||||
@@ -305,7 +297,7 @@ func (h *genHelper) genWuffs(dirname string, qualifiedFilenames []string) error
|
|||||||
if n.Suspendible() {
|
if n.Suspendible() {
|
||||||
effect = "?"
|
effect = "?"
|
||||||
}
|
}
|
||||||
fmt.Fprintf(out, "pub struct %s_%s%s()\n", prefix, n.Name().Str(&h.tm), effect)
|
fmt.Fprintf(out, "pub struct %s%s()\n", n.Name().Str(&h.tm), effect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user