Better name for this error.
Chris Pressey
3 years ago
42 | 42 | |
43 | 43 | |
44 | 44 | class IllegalJumpError(StaticAnalysisError): |
45 | pass | |
46 | ||
47 | ||
48 | class TerminatedContextError(StaticAnalysisError): | |
49 | """What the program is doing here is not valid, due to preceding `goto`s, | |
50 | which make this dead code.""" | |
45 | 51 | pass |
46 | 52 | |
47 | 53 | |
138 | 144 | self._touched = set(other._touched) |
139 | 145 | self._range = dict(other._range) |
140 | 146 | self._writeable = set(other._writeable) |
147 | self._terminated = other._terminated | |
148 | self._gotos_encounters = set(other._gotos_encountered) | |
141 | 149 | |
142 | 150 | def each_meaningful(self): |
143 | 151 | for ref in self._range.keys(): |
415 | 423 | raise InconsistentInitializationError('?') |
416 | 424 | if set(ex.each_touched()) != exit_touched: |
417 | 425 | raise InconsistentInitializationError('?') |
426 | # FIXME: confirm writeable sets are the same too? | |
418 | 427 | context.update_from(exit_context) |
419 | 428 | |
420 | 429 | trashed = set(context.each_touched()) - set(context.each_meaningful()) |
469 | 478 | src = instr.src |
470 | 479 | |
471 | 480 | if context.has_terminated(): |
472 | raise IllegalJumpError(instr, instr) # TODO: maybe a better name for this | |
481 | raise TerminatedContextError(instr, instr) | |
473 | 482 | |
474 | 483 | if opcode == 'ld': |
475 | 484 | if isinstance(src, IndexedRef): |