diff --git a/src/sixtypical/analyzer.py b/src/sixtypical/analyzer.py index f8ac112..d2d01f2 100644 --- a/src/sixtypical/analyzer.py +++ b/src/sixtypical/analyzer.py @@ -286,12 +286,13 @@ class Analyzer(object): # it will always be executed at least once, so analyze it having # been executed the first time. self.analyze_block(instr.block, context) - + context.assert_meaningful(src) + # now analyze it having been executed a second time, with the context # of it having already been executed. self.analyze_block(instr.block, context) - - # NB I *think* that's enough... but it might not be? + context.assert_meaningful(src) + elif opcode == 'copy': # check that their types are basically compatible if src.type == dest.type: diff --git a/tests/SixtyPical Analysis.md b/tests/SixtyPical Analysis.md index 7eaff5a..82d08d6 100644 --- a/tests/SixtyPical Analysis.md +++ b/tests/SixtyPical Analysis.md @@ -1017,6 +1017,23 @@ initialized at the start. | } ? UnmeaningfulReadError: y in main +And if you trash the test expression (i.e. `z` in the below) inside the loop, +this is an error too. + + | word one : 0 + | word two : 0 + | + | routine main + | inputs one, two + | outputs two + | trashes a, z, n + | { + | repeat { + | copy one, two + | } until z + | } + ? UnmeaningfulReadError: z in main + ### copy ### Can't `copy` from a memory location that isn't initialized.