I encountered a very odd bug, apparently in my code, not Rhino,
assuming "yield" is a reserved word in Rhino.

I don't understand this behavior at all. I just thought it was
interesting, and would be interested to hear an explanation.

Here's some test cases (test on: Rhino 1.7 release 2 PRERELEASE 2008
07 28)

    if (!this.alert)
        this.alert = print;

    var something = function() { alert("CORRECT!!!"); },
        other = function() { alert("WRONG."); };

    var testA = function() {
        var yield = something;
        yield();
    };

    var testB = function() {
        alert(something);
        var yield = something || other;
        yield();
    };

    var testC = function() {
        var notYield = something;
        notYield();
    };

    var testD = function() {
        alert(something);
        var notYield = something || other;
        notYield();
    };

    alert("==== A ====")
    try{testA();}catch(e){alert("EXCEPTION: "+e)}
    alert("==== B ====")
    try{testB();}catch(e){alert("EXCEPTION: "+e)}
    alert("==== C ====")
    try{testC();}catch(e){alert("EXCEPTION: "+e)}
    alert("==== D ====")
    try{testD();}catch(e){alert("EXCEPTION: "+e)}
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to