minifer issue ?

0 favourites
  • 3 posts
  • the C3 minifier (simple mode) turn this part of my addon code :

    children_update(){
    	if(!this.children.length){
    		return;
    	}
    	var inst,wi;
    	for (var i = 0, l= this.children.length; i < l; i++) {
    		inst = this.children[i];
    		wi = inst.GetWorldInfo();
    	
    		//updating the child's global coordinates when the parent global coordinates changes.
    		wi.SetXY(wi.GetX(),wi.GetY());
    		wi.SetAngle(wi.GetAngle());
    		wi.SetBboxChanged();
    	}
    }
    

    to this:

    children_update() {
    if (this.children.length)
    for (var e = 0, t = this.children.length, a, n; void 0 > e; e++) a = this.children[e], n = a.GetWorldInfo(), n.SetXY(n.GetX(), n.GetY()), n.SetAngle(n.GetAngle()), n.SetBboxChanged()
    }
    

    the void 0 > e is breaking my code, the loop does not work.

    Also, when I put some console.log before the loop and inside it. The loop is minifed correclty; no more void 0 > e.

    So what's going on ? thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Minification is done by babel-minify. If you can reproduce the problem independently, you could file an issue with them (although I'm not sure how actively maintained the project is any more). Occasionally though the pragmatic thing to do is just work around it and move on.

  • ok thanks.

    The issue is already opened here:

    github.com/babel/minify/issues/976

    A workaround that worked for me is to put the declaration of l = array.length outside the loop.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)