jalangi2 icon indicating copy to clipboard operation
jalangi2 copied to clipboard

Instrumentation introduces SyntaxError (Identifier has already been declared)

Open christofferqa opened this issue 8 years ago • 2 comments

The following program runs without errors.

function inc() {}
var inc = function (i) {
  return i+1;
};

Running the jalangi-instrumented program yields an uncaught SyntaxError: "Uncaught SyntaxError: Identifier 'inc' has already been declared".

The problem seems to be related to the insertion of while (true) around every script. Indeed, the following script apparently yields a SyntaxError in Chrome.

while (true) {
  function inc() {}
  var inc = function (i) {
    return i+1;
  };
}

christofferqa avatar Sep 13 '16 08:09 christofferqa

Created a Chrome issue, https://bugs.chromium.org/p/chromium/issues/detail?id=646305

christofferqa avatar Sep 13 '16 10:09 christofferqa

It appears that function declarations implicitly become let-bindings (the error message in Firefox is: "SyntaxError: redeclaration of let inc"). This should be fixed in jalangi.

christofferqa avatar Sep 13 '16 10:09 christofferqa