jalangi2 icon indicating copy to clipboard operation
jalangi2 copied to clipboard

Bug: wrong base-object for with-statement function calls

Open esbena opened this issue 9 years ago • 0 comments

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]

esbena avatar Jun 24 '15 18:06 esbena