haxe icon indicating copy to clipboard operation
haxe copied to clipboard

Unroll arrays from arguments of inlined functions

Open RealyUniqueName opened this issue 6 years ago • 2 comments

Can we have loop unrolling in inlined functions?

class Test {
  static function main() {
    test([1, 2]);
  }
  
  static inline function test(a:Array<Int>) {
    for(i in a) {
      trace(i);
    }
  }
}

generated output:

// Generated by Haxe 4.0.0-rc.1+c951675
(function () { "use strict";
var Test = function() { };
Test.main = function() {
	var a = [1,2];
	var _g = 0;
	while(_g < a.length) console.log("root/program/Test.hx:8:",a[_g++]);
};
Test.main();
})();

http://try-haxe.mrcdk.com/#9170b

RealyUniqueName avatar Feb 22 '19 10:02 RealyUniqueName