use :node;

var Node = module.require('../Node').Node;

fn ForStatement(init, test, update, body)

extends Node {

this.type = 'ForStatement';

this.init = init; 
if this.init? {
  this.init.parent = this;
}

this.test = test;
if this.test? {
  this.test.parent = this;
}

this.update = update;
if this.update? {
  this.update.parent = this;
}

this.body = body;
this.body.parent = this;

}

ForStatement.prototype.codegen = () -> {

if !super.codegen() {
  return;
}

if this.init? {
  this.init = this.init.codegen();
}

if this.test? {
  this.test = this.test.codegen();
}

if this.update? {
  this.update = this.update.codegen();
}

this.body = this.body.blockWrap().codegen();

return this;

};

exports.ForStatement = ForStatement;