Tweak io_bind syntax

This commit is contained in:
Nigel Tao committed 2018-12-09 09:13:29 +11:00
1 parent e992921dce
commit badbdfc487
7 files changed
+62 -88

No files matched your search

+2 -3
View File
@@ -173,9 +173,8 @@ const (
)
const (
maxIOBinds = 100
maxIOBindInFields = 100
maxTemp = 10000
maxIOBinds = 100
maxTemp = 10000
)
type status struct {
+5 -10
View File
@@ -225,12 +225,7 @@ func (g *gen) writeStatementAssign(b *buffer,
}
func (g *gen) writeStatementIOBind(b *buffer, n *a.IOBind, depth uint32) error {
inFields := n.InFields()
if n.Keyword() == t.IDIOLimit {
inFields = []*a.Node{n.IO().AsNode()}
}
if g.currFunk.ioBinds > maxIOBinds || len(inFields) > maxIOBindInFields {
if g.currFunk.ioBinds > maxIOBinds {
return fmt.Errorf("too many temporary variables required")
}
ioBindNum := g.currFunk.ioBinds
@@ -240,8 +235,8 @@ func (g *gen) writeStatementIOBind(b *buffer, n *a.IOBind, depth uint32) error {
// instead of block-scoped (smaller scope) if the coro_susp_point
// switch can jump past this initialization??
b.writes("{\n")
for i := 0; i < len(inFields); i++ {
e := inFields[i].AsExpr()
{
e := n.IO()
prefix := vPrefix
if e.Operator() != 0 {
prefix = aPrefix
@@ -278,8 +273,8 @@ func (g *gen) writeStatementIOBind(b *buffer, n *a.IOBind, depth uint32) error {
}
}
for i := len(inFields) - 1; i >= 0; i-- {
e := inFields[i].AsExpr()
{
e := n.IO()
prefix := vPrefix
if e.Operator() != 0 {
prefix = aPrefix