Looks like, when we "goto", we should "pull in" the constraints.
Chris Pressey
6 years ago
389 | 389 | print('-' * 79) |
390 | 390 | print('') |
391 | 391 | |
392 | # even if we goto another routine, we can't trash an output. | |
392 | # these all apply whether we encountered goto(s) in this routine, or not...: | |
393 | ||
394 | # can't trash an output. | |
393 | 395 | for ref in trashed: |
394 | 396 | if ref in type_.outputs: |
395 | 397 | raise UnmeaningfulOutputError(routine, ref.name) |
396 | 398 | |
397 | if not context.encountered_gotos(): | |
398 | for ref in type_.outputs: | |
399 | context.assert_meaningful(ref, exception_class=UnmeaningfulOutputError) | |
400 | for ref in context.each_touched(): | |
401 | if ref not in type_.outputs and ref not in type_.trashes and not routine_has_static(routine, ref): | |
402 | raise ForbiddenWriteError(routine, ref.name) | |
399 | # all outputs are meaningful. | |
400 | for ref in type_.outputs: | |
401 | context.assert_meaningful(ref, exception_class=UnmeaningfulOutputError) | |
402 | ||
403 | # if something was touched, then it should have been declared to be writable. | |
404 | for ref in context.each_touched(): | |
405 | if ref not in type_.outputs and ref not in type_.trashes and not routine_has_static(routine, ref): | |
406 | raise ForbiddenWriteError(routine, ref.name) | |
407 | ||
403 | 408 | self.current_routine = None |
404 | 409 | return context |
405 | 410 |