Closed vantreeseba closed 11 months ago
This seems to be a conflict between -D js-es=6 and genes.
I'm assuming somehow the js output is guessing it can re-use var names when it is in es6 cause it thinks it's outputting let.
This is what it looks like "fixed" without the es=6 part
notice the new g3,g4 vars in the nested loop compared to above.
static getRect(map, rect, wrap) {
if (wrap == null) {
wrap = false;
};
var _g = [];
var _g1 = rect.y;
var _g2 = rect.y + rect.height;
while (_g1 < _g2) {
var j = _g1++;
var _g3 = rect.x;
var _g4 = rect.x + rect.width;
while (_g3 < _g4) {
var i = _g3++;
if (wrap) {
_g.push(map._mapData[map._width * (j % map._height) + i % map._width]);
} else {
_g.push(map._mapData[map._width * j + i]);
};
};
};
return _g;
}
Could you include the original Haxe code that was transpiled? It'll help write a test case
Sometimes genes will generate var instead of let in functions, this causes var shadowing in nested loops which makes the output basically invalid.
Here are examples:
JS GENERATOR
GENES: