@@ -591,6 +591,11 @@ module Fusion = struct
change_num_uses v2 (-1);
let e = (f {e1 with eexpr = TUnop(op,Postfix,ev)}) in
fuse (e :: acc) el
+ | TLocal v2 when v == v2 ->
+ changed := true;
+ change_num_uses v2 (-1);
+ let e = (f {e1 with eexpr = TUnop(op,Prefix,ev)}) in
+ fuse (e :: acc) el
| _ ->
raise Exit
end
@@ -548,6 +548,15 @@ class TestJs {
a[i++] = i++;
}
+ @:js('
+ var i = 5;
+ while(--i >= 0) TestJs["use"](i);
+ ')
+ static function testPrefixRebuilding() {
+ var i:Int = 5;
+ while (--i >= 0) use(i);
+ }
+
static inline function inlineCall<S, T>(d1:S, d2:T) {
return call(d2, d1);