fb39ca4 / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

Break and continue don't work properly scope. #96

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Example:

#include <stdio.h>

int a;
char b;

a = 0;
while (a < 2)
{
    printf("%d", a++);
    break;

    b = 'A';
    while (b < 'C')
    {
        printf("%c", b++);
    }
}

This should print only '0' but instead you see '01', i.e. depth is not handled 
correctly and in fact the second while is breaking, not the first.

One solution is to add CurrentDepth and BreakContinueDepth to struct 
ParseState. These would be used to record depths and allow breaking at correct 
statement level.

Original issue reported on code.google.com by duncan.f...@gmail.com on 27 Jul 2010 at 4:50

GoogleCodeExporter commented 8 years ago
Scheduled for release 2.0

Original comment by zik.sale...@gmail.com on 27 Jul 2010 at 10:56

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r509.

Original comment by zik.sale...@gmail.com on 11 Feb 2011 at 6:28