summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-04-10 01:50:57 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-04-10 01:50:57 -0400
commit449fc06b72adf56d3b960310dc9e012145ad9ae4 (patch)
tree06bb93a6f04fb8b95c2839dec9963b28d489f14d
parent3a9dbb4b5491a6ae813e4632bf17a5b5f00e8e0c (diff)
Tweak how continue and break perform
-rw-r--r--src/texec/eval.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/texec/eval.go b/src/texec/eval.go
index 510805e..40e2523 100644
--- a/src/texec/eval.go
+++ b/src/texec/eval.go
@@ -1103,25 +1103,25 @@ func evalCF(v tparse.Node, ctx *VarMap) (bool, TVariable, int) {
}
return true, null, 0
case "break":
- brk := 1
+ brk := 0
if len(v.Sub[i].Sub) > 0 {
brk = getIntLiteral(v.Sub[i].Sub[0])
}
if !loop {
- return false, null, brk
+ return false, null, brk + 1
}
- return false, null, brk - 1
+ return false, null, brk
case "continue":
- cont := 1
+ cont := 0
if len(v.Sub[i].Sub) > 0 {
cont = getIntLiteral(v.Sub[i].Sub[0])
}
if !loop {
- return false, null, -cont
- } else if cont == 1 {
+ return false, null, -(cont + 1)
+ } else if cont == 0 {
goto CONCF
}
- return false, null, 1 - cont
+ return false, null, -cont
}
}