Sha256: 724c9dcb405338351092d808caa2e5555e9aedf4307c000132869f3e8bba4772

Contents?: true

Size: 1.12 KB

Versions: 43

Compression:

Stored size: 1.12 KB

Contents

/*jsl:option explicit*/
function ambiguous_nested_stmt() {
    var a, i, s;
    a = new Array(1, 2, 3);

    /* legal: else if */
    if (s == "false") {
        i = 0;
    }
    else if (s == "true") {
        i = 1;
    }

    /* if, else */
    if (true)
        s = "A";
    else
        s = "B";

    /* skip with */

    /* try, catch, finally always require braces */

    /* do...while */
    do s += ".";
    while (false);

    /* for */
    for (i = 0; i < 20; i += 1)
        s += i;

    /* for...in */
    for (i in a)
        s += a[i];

    /* while */
    while (i > 0)
        s += "~";

    /* illegal */
    if (i)
        if (s) { /*warning:ambiguous_nested_stmt*/
            i = s;
        }
        else { /*warning:ambiguous_else_stmt*/
            s = i;
        }

    /* illegal */
    if (i)
        while (s) { /*warning:ambiguous_nested_stmt*/
            i = s;
        }

    /* illegal */
    if (i)
        do { /*warning:ambiguous_nested_stmt*/
            i = s;
        } while (s);

    /* illegal */
    if (i)
        for (i = 0; i < 1; i++) { /*warning:ambiguous_nested_stmt*/
            i++;
        }
}

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
distil-0.14.5.a vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.4 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.3 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.2 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.2.a vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.1 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.1.a vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.0 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.0.i vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.0.h vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.0.g vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.0.d vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.0.c vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.14.0.b vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.13.6 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.13.5 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.13.4 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.13.3 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.13.2 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js
distil-0.13.1 vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js