parse.y: Traverse AST post parsing to detect break/next usage issues

Seemed easiest to do it via the traversal infrastructure as we do not
otherwise track enough context/scope when instantiating break or next
statements.

Might be worth moving this out of src/parse.y, but didn't exactly know
where. Or maybe we wait until there's more such trivial validations
popping up

Fixes #2440
This commit is contained in:
Arne Welzel 2022-10-26 13:47:54 +02:00
parent 2ed42ef771
commit 850aaaa5a8
15 changed files with 227 additions and 2 deletions

View file

@ -0,0 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 3: break statement used outside of for, while or switch statement and not within a hook