rust-js / rjs

Rust JavaScript interpreter
98 stars 6 forks source link

With object property shadowing argument in deopt and arguments mode matches argument, not with object property #23

Closed pvginkel closed 9 years ago

pvginkel commented 9 years ago

The following should output 6, not 7:

function f(a) {
    arguments[0]++;
    with ({a:1}) {
        var g = function (b) {
            arguments[0]++;
            return a + b + eval('1');
        }
    }
    return g(a + 1);
}
throw f(1);

The problem is that a is resolved to the argument and is not dynamically resolved to the with local.