Skip to content

handling labeled branching statements

I would like to handle this case:

    public static int foo(int initial_i, int initial_j) {

        int i = initial_i + 1;
        int j = initial_j - 2;

        i++;
        mywhile:
        while (j > 3) {
            j--;



            if (i < 5) {
                break mywhile;
                i += 4000;
            }
        }
    }

In the IR I get, the ASTWhile block does not contain the label "mywhile", and the ASTBreak reports the information code: 'break mywhile;' but I would like a separate key for the label (e.g. label: 'mywhile'). In this way I can handle the most general form of the break statement.

Similarly for switch, for and do.