From e765f9e74abc81b738e8670c6d77d363894107b1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 27 Apr 2016 15:23:44 -0700 Subject: 2873 - fix a bug in converting conditional returns This was an interaction between two transforms. The first turned: return-if ... into: jump-unless ..., 1:offset # skip next instruction return ... The second added an unconditional return at the end of the recipe if it didn't already exist (so that functions always end with a return). However, it was getting confused by the return instructions generated above, which look unconditional but sometimes get skipped. To fix this, conditional returns are now transformed into this: { break-unless ... return ... } Since the final instruction is now no longer a reply (but rather the '}' label), the second transform triggers and adds the unconditional return after it. This commit removes the final place marked 'BUG:' in the codebase yesterday (see commit 2870). --- chessboard.mu | 1 - 1 file changed, 1 deletion(-) (limited to 'chessboard.mu') diff --git a/chessboard.mu b/chessboard.mu index 3d6b93e2..9bd5adef 100644 --- a/chessboard.mu +++ b/chessboard.mu @@ -259,7 +259,6 @@ def read-move stdin:address:source:character, screen:address:screen -> result:ad *result <- put *result, to-rank:offset, to-rank error? <- expect-from-channel stdin, 10/newline, screen return-if error?, 0/dummy, 0/quit - return result # BUG: why is this statement required? ] # valid values for file: 0-7 -- cgit 1.4.1-2-gfad0