Sha256: 46ba3547953c53a8f7cc852e79e9577eddde0c0933a1534f1e8b3a2bb4e31836

Contents?: true

Size: 1.27 KB

Versions: 43

Compression:

Stored size: 1.27 KB

Contents

/*jsl:option explicit*/
var g;
function option_explicit(parm) {
    /* legal - j is declared */
    g = j;
    var j;

    var s;

    /* legal - function referencing parameter in parent */
    var fn = function() { return parm; };

    /* legal - function referening variable in parent */
    var fn2 = function() { return s; };

    /* legal - defined below */
    var o = new Child();

    /* legal - function referencing variable in grandparent */
    function Child() {
        function Grandchild() {
            if (parm) {
                return s;
            }
            return null;
        }
    }

    /* legal - catch variable */
    try {
        throw null;
    }
    catch (err) {
        return err;
    }

    /* legal - recursion */
    option_explicit(parm);

    /* legal - this is a property, not a variable */
    this.q = -1;

    /* legal - global */
    g++;

    /* legal - ignore undeclared identifier */
    /*jsl:ignore*/
    g = undefined_var;
    /*jsl:end*/

    /* illegal - undeclared global */
    z--; /*warning:undeclared_identifier*/

    /* illegal - undeclared global */
    y(); /*warning:undeclared_identifier*/

    /* illegal */
    x = 14; /*warning:undeclared_identifier*/

    /* illegal */
    y(); /*warning:undeclared_identifier*/

    return "";
}

Version data entries

43 entries across 43 versions & 1 rubygems

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