* Fix #12785 and add test

* better variable name
This commit is contained in:
RSDuck 2019-12-21 07:51:19 +01:00 • committed by Andreas Rumpf
commit 9b8afd1dbb
2 changed files with 51 additions and 0 deletions

View file

@ -492,6 +492,10 @@ iterator fieldValuePairs(n: PNode): tuple[memberSym, valueSym: PNode] =
proc genComputedGoto(p: BProc; n: PNode) =
# first pass: Generate array of computed labels:
# flatten the loop body because otherwise let and var sections
# wrapped inside stmt lists by inject destructors won't be recognised
let n = n.flattenStmts()
var casePos = -1
var arraySize: int
for i in 0..<n.len: