mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 08:47:28 +01:00
lang: refactor anticipating io_forget_history
This commit is contained in:
1 parent
c21cc95713
commit
e8af2d0635
5 files changed
+60
-44
No files matched your search
@@ -331,11 +331,13 @@ func (h *livenessHelper) doIOManip(r livenesses, n *a.IOManip, depth uint32) err
|
||||
if err := h.doExpr(r, n.IO()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := h.doExpr(r, n.Arg1()); err != nil {
|
||||
return err
|
||||
if arg1 := n.Arg1(); arg1 != nil {
|
||||
if err := h.doExpr(r, arg1); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if histPos := n.HistoryPosition(); histPos != nil {
|
||||
if err := h.doExpr(r, n.HistoryPosition()); err != nil {
|
||||
if err := h.doExpr(r, histPos); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ func (g *gen) writeStatementIOManip(b *buffer, n *a.IOManip, depth uint32) error
|
||||
// switch can jump past this initialization??
|
||||
b.writes("{\n")
|
||||
{
|
||||
if n.Keyword() == t.IDIOBind {
|
||||
if keyword := n.Keyword(); keyword == t.IDIOBind {
|
||||
b.printf("wuffs_base__io_buffer* %s%d_%s%s = %s%s;\n",
|
||||
oPrefix, ioBindNum, prefix, name,
|
||||
prefix, name)
|
||||
@@ -382,7 +382,7 @@ func (g *gen) writeStatementIOManip(b *buffer, n *a.IOManip, depth uint32) error
|
||||
}
|
||||
|
||||
{
|
||||
if n.Keyword() == t.IDIOBind {
|
||||
if keyword := n.Keyword(); keyword == t.IDIOBind {
|
||||
b.printf("%s%s = %s%d_%s%s;\n",
|
||||
prefix, name,
|
||||
oPrefix, ioBindNum, prefix, name)
|
||||
@@ -395,11 +395,14 @@ func (g *gen) writeStatementIOManip(b *buffer, n *a.IOManip, depth uint32) error
|
||||
b.printf("%s%s%s = %s%d_%s%s%s;\n",
|
||||
io1Prefix, prefix, name,
|
||||
oPrefix, ioBindNum, io1Prefix, prefix, name)
|
||||
}
|
||||
b.printf("%s%s%s = %s%d_%s%s%s;\n",
|
||||
io2Prefix, prefix, name,
|
||||
oPrefix, ioBindNum, io2Prefix, prefix, name)
|
||||
if n.Keyword() == t.IDIOLimit {
|
||||
b.printf("%s%s%s = %s%d_%s%s%s;\n",
|
||||
io2Prefix, prefix, name,
|
||||
oPrefix, ioBindNum, io2Prefix, prefix, name)
|
||||
|
||||
} else {
|
||||
b.printf("%s%s%s = %s%d_%s%s%s;\n",
|
||||
io2Prefix, prefix, name,
|
||||
oPrefix, ioBindNum, io2Prefix, prefix, name)
|
||||
b.printf("if (%s%s) {\n", prefix, name)
|
||||
b.printf("%s%s->meta.closed = %s%d_closed_%s%s;\n",
|
||||
prefix, name, oPrefix, ioBindNum, prefix, name)
|
||||
|
||||
Reference in new issue
Block a user