stmt/for: fix precondition checks
This commit is contained in:
parent
1206881bec
commit
7dbb523763
4
node.go
4
node.go
@ -245,7 +245,7 @@ func convert(n_ node.Node) (string, error) {
|
|||||||
return "", parseErr{n, err}
|
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))}
|
return "", parseErr{n, fmt.Errorf("for loop can only have 1 cond clause, found %d", len(n.Cond))}
|
||||||
}
|
}
|
||||||
fcond, err := convert(n.Cond[0])
|
fcond, err := convert(n.Cond[0])
|
||||||
@ -253,7 +253,7 @@ func convert(n_ node.Node) (string, error) {
|
|||||||
return "", parseErr{n, err}
|
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))}
|
return "", parseErr{n, fmt.Errorf("for loop can only have 1 loop clause, found %d", len(n.Loop))}
|
||||||
}
|
}
|
||||||
loopStmt := n.Loop[0]
|
loopStmt := n.Loop[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user