jalangi2
jalangi2 copied to clipboard
Bug: wrong base-object for with-statement function calls
Function calls done inside with-statements can receive the wrong base object.
It seems that function calls always are treated as function calls while they should be treated as method calls when the callee is found on the "with-object".
Source:
function f() {console.log(this + '');}
var x = {m: function() {console.log(this + '');}}
with (x) {
f();
m();
}
Output uninstrumented/instrumented:
$ node test.js
[object global]
[object Object]
$ node src/js/commands/jalangi.js test.js
[object global]
[object global]