stepan-mitkin / drakon.tech

Drakon.Tech is an IDE based on the DRAKON visual language
The Unlicense
64 stars 15 forks source link

No exit from loop #2

Open stepan-mitkin opened 4 years ago

stepan-mitkin commented 4 years ago

Converging Case branches above a foreach loop cause an infinite loop

stepan-mitkin commented 4 years ago

20200405075618

This results in

function noExitFromLoop(one, two, three) {
    var _7_col, _7_it, _7_length, _sw_17, item;
    _sw_17 = one;
    if (_sw_17 === "update") {
        _7_it = 0;
        _7_col = three;
        _7_length = _7_col.length;
        while (true) {
            if (_7_it < _7_length) {
                item = _7_col[_7_it];
                _7_it++;
            } else {
                break;
            }
        }
    } else {
        if (_sw_17 === "delete") {
            one = "foo"
            _7_it = 0;
            _7_col = three;
            _7_length = _7_col.length;
            // Infinite loop!
            while (true) {
                if (_7_it < _7_length) {
                    item = _7_col[_7_it];
                    _7_it++;
                }
            }
        } else {
        }
    }
}
stepan-mitkin commented 4 years ago

20200412182431