duktape
duktape copied to clipboard
An issue about the increment operator
Version
Overview
When I calculate a-++a, duktape first calculates ++a and then a-a, and the final result is 0. However, other engines, such as v8, chakra, the result is -1. So I think it may be a bug of duktape.
Testcase
var NISLFuzzingFunc = function () {
var a = 1;
return a - ++a;
};
var NISLCallingResult = NISLFuzzingFunc();
print(NISLCallingResult);
Actual Results
0
Expected Results
-1
There seems to be a bug in handling the expression when 'a' is register based. When it is e.g. a global variable the evaluation order is correct.
Thanks for reporting, I'll check it out.