Currently array comprehension will invoke ofArray does a .copy() call, which is unnecessary
var a:Vector<Int> = [for(i in 0...2) i];
generates:
var _g = [];
_g.push(0);
_g.push(1);
var this1 = _g.slice();
I guess the reason is that typeExpr will convert a EArrayDecl into some "init+push" instructions does breaking the switch. I wonder why if we can't just rely on EArrayDecl instead of TArrayDecl in the first case?
Currently array comprehension will invoke
ofArray
does a.copy()
call, which is unnecessarygenerates:
I guess the reason is that
typeExpr
will convert aEArrayDecl
into some "init+push" instructions does breaking the switch. I wonder why if we can't just rely onEArrayDecl
instead ofTArrayDecl
in the first case?https://github.com/haxetink/tink_pure/blob/f93e378516aeda3b31487c09f46300714b86a49a/src/tink/pure/Vector.hx#L84-L85