git @ Cat's Eye Technologies SixtyPical / 07ec675
Introduce yet another new error. Chris Pressey 6 years ago
1 changed file(s) with 14 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
3030
3131
3232 class InconsistentInitializationError(StaticAnalysisError):
33 pass
34
35
36 class InconsistentExitError(StaticAnalysisError):
37 """The type context differs at two different exit points of the routine."""
3338 pass
3439
3540
153158
154159 def each_touched(self):
155160 for ref in self._touched:
161 yield ref
162
163 def each_writeable(self):
164 for ref in self._writeable:
156165 yield ref
157166
158167 def assert_meaningful(self, *refs, **kwargs):
418427 exit_context = self.exit_contexts[0]
419428 exit_meaningful = set(exit_context.each_meaningful())
420429 exit_touched = set(exit_context.each_touched())
430 exit_writeable = set(exit_context.each_writeable())
421431 for ex in self.exit_contexts[1:]:
422432 if set(ex.each_meaningful()) != exit_meaningful:
423 raise InconsistentInitializationError('?')
433 raise InconsistentExitError("Exit contexts are not consistent")
424434 if set(ex.each_touched()) != exit_touched:
425 raise InconsistentInitializationError('?')
426 # FIXME: confirm writeable sets are the same too?
435 raise InconsistentExitError("Exit contexts are not consistent")
436 if set(ex.each_writeable()) != exit_writeable:
437 raise InconsistentExitError("Exit contexts are not consistent")
427438 context.update_from(exit_context)
428439
429440 trashed = set(context.each_touched()) - set(context.each_meaningful())