stmt/for: fix precondition checks

This commit is contained in:
mappu 2020-04-05 16:41:36 +12:00
parent 1206881bec
commit 7dbb523763

View File

@ -245,7 +245,7 @@ func convert(n_ node.Node) (string, error) {
return "", parseErr{n, err}
}
if len(n.Init) != 1 {
if len(n.Cond) != 1 {
return "", parseErr{n, fmt.Errorf("for loop can only have 1 cond clause, found %d", len(n.Cond))}
}
fcond, err := convert(n.Cond[0])
@ -253,7 +253,7 @@ func convert(n_ node.Node) (string, error) {
return "", parseErr{n, err}
}
if len(n.Init) != 1 {
if len(n.Loop) != 1 {
return "", parseErr{n, fmt.Errorf("for loop can only have 1 loop clause, found %d", len(n.Loop))}
}
loopStmt := n.Loop[0]