mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 08:52:18 +01:00
Remove hard-coded cgen of lzw's read_from method
This commit is contained in:
1 parent
ef51d032ba
commit
eb108af98a
2 files changed
+9
-29
No files matched your search
@@ -263,11 +263,8 @@ func (g *gen) writeFuncImplPrologue(b *buffer) error {
|
||||
}
|
||||
b.writes("\n")
|
||||
|
||||
if g.currFunk.astFunc.Effect().Optional() ||
|
||||
// TODO: delete this lzw.read_from hack.
|
||||
((g.pkgName == "lzw") && (g.currFunk.astFunc.FuncName().Str(g.tm) == "read_from")) {
|
||||
|
||||
g.findDerivedVars()
|
||||
g.findDerivedVars()
|
||||
if g.currFunk.derivedVars != nil {
|
||||
for _, o := range g.currFunk.astFunc.In().Fields() {
|
||||
o := o.AsField()
|
||||
if err := g.writeLoadDerivedVar(b, "", aPrefix, o.Name(), o.XType(), true); err != nil {
|
||||
@@ -334,8 +331,11 @@ func (g *gen) writeFuncImplBodySuspend(b *buffer) error {
|
||||
}
|
||||
|
||||
func (g *gen) writeFuncImplEpilogue(b *buffer) error {
|
||||
// TODO: delete this lzw.read_from hack.
|
||||
if (g.pkgName == "lzw") && (g.currFunk.astFunc.FuncName().Str(g.tm) == "read_from") {
|
||||
if g.currFunk.astFunc.Effect().Optional() {
|
||||
b.writes("goto exit;exit:") // The goto avoids the "unused label" warning.
|
||||
}
|
||||
|
||||
if g.currFunk.derivedVars != nil {
|
||||
for _, o := range g.currFunk.astFunc.In().Fields() {
|
||||
o := o.AsField()
|
||||
if err := g.writeSaveDerivedVar(b, "", aPrefix, o.Name(), o.XType()); err != nil {
|
||||
@@ -346,16 +346,6 @@ func (g *gen) writeFuncImplEpilogue(b *buffer) error {
|
||||
}
|
||||
|
||||
if g.currFunk.astFunc.Effect().Optional() {
|
||||
b.writes("goto exit;exit:") // The goto avoids the "unused label" warning.
|
||||
|
||||
for _, o := range g.currFunk.astFunc.In().Fields() {
|
||||
o := o.AsField()
|
||||
if err := g.writeSaveDerivedVar(b, "", aPrefix, o.Name(), o.XType()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
b.writes("\n")
|
||||
|
||||
if g.currFunk.astFunc.Public() {
|
||||
b.writes("if (wuffs_base__status__is_error(status)) { " +
|
||||
"self->private_impl.magic = WUFFS_BASE__DISABLED; }\n")
|
||||
|
||||
Reference in new issue
Block a user