Ticket #346 (new defect)
Opened 11 years ago
Cannot break out of a loop from within a branch
Reported by: | nerdzero | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Cobra Compiler | Version: | 0.9.4 |
Keywords: | branch, break, loop | Cc: |
Description
The generated C# treats the 'break' statement as being part of the switch structure instead of breaking out of the loop.
Test case that results in infinite loop.
class Program def main x = 1 while true branch x on 1 trace x break else print "Should not get printed" print "done"
One solution is to generate a goto statement in the C#. Some more alternatives are here: http://stackoverflow.com/questions/1987379/break-out-of-a-loop-that-contains-a-switch-statement-c
Note: See
TracTickets for help on using
tickets.