|
| 1 | +-- ============================================================================ |
| 2 | +-- Bug #263: Preserve decision/loop captions across nested control flow |
| 3 | +-- ============================================================================ |
| 4 | +-- |
| 5 | +-- Symptom (before fix): |
| 6 | +-- `@caption` on an outer IF/LOOP/WHILE was being overwritten by the inner |
| 7 | +-- IF/LOOP's caption because `pendingAnnotations` was shared mutable state |
| 8 | +-- across recursive addStatement calls. Annotations attached to the outer |
| 9 | +-- split ended up bound to the inner split, and the outer split inherited |
| 10 | +-- whatever caption the inner statement carried. |
| 11 | +-- |
| 12 | +-- After fix: |
| 13 | +-- addIfStatement / addLoopStatement / addWhileStatement snapshot + clear |
| 14 | +-- `pendingAnnotations` before recursing, then re-apply to their own activity |
| 15 | +-- after it's created. The WHILE case also gained explicit handling in |
| 16 | +-- mergeStatementAnnotations (previously fell through to `default: nil`). |
| 17 | +-- |
| 18 | +-- Usage: |
| 19 | +-- mxcli exec mdl-examples/bug-tests/263-nested-caption-preservation.mdl -p app.mpr |
| 20 | +-- Open in Studio Pro — each split/loop displays its own caption, not |
| 21 | +-- inherited from a nested statement. |
| 22 | +-- ============================================================================ |
| 23 | + |
| 24 | +create module BugTest263; |
| 25 | + |
| 26 | +create microflow BugTest263.MF_NestedCaptions ( |
| 27 | + $S: string |
| 28 | +) |
| 29 | +returns boolean as $ok |
| 30 | +begin |
| 31 | + declare $ok boolean = false; |
| 32 | + |
| 33 | + @caption 'String not empty?' |
| 34 | + if $S != empty then |
| 35 | + @caption 'Right format?' |
| 36 | + if isMatch($S, 'x') then |
| 37 | + return true; |
| 38 | + else |
| 39 | + return false; |
| 40 | + end if; |
| 41 | + else |
| 42 | + return false; |
| 43 | + end if; |
| 44 | +end; |
| 45 | +/ |
0 commit comments