tessel / t1-runtime

[UNMAINTAINED] Tessel 1 JavaScript runtime.
Other
117 stars 33 forks source link

Compound assignment and member expression #504

Open PaulBernier opened 10 years ago

PaulBernier commented 10 years ago

As for #503 I found this bug in castl by executing navier-stokes.js of Octane2 benchmark. This is same kind of problem, it happens with compound assignment (@= where @ is a binary operator such as +,-,/,...)

var index = 0;
var array = [1,2,3];
array[++index] += ++index
console.log(array);

should display:

[ 1, 4, 3 ]
rwaldron commented 10 years ago

Confirmed.

Test case:

var tap = require('../tap');
tap.count(3);

var index = 0;
var array = [1, 2, 3];
array[++index] += ++index;

[1, 4, 3].forEach(function(value, index) {
  tap.eq(array[index], value);
});

Produces:

$ colony test/issues/issue-runtime-504.js
1..3
ok 1 - undefined: 1 == 1
not ok 2 - undefined: 6 == 4
ok 3 - undefined: 3 == 3