use :node;

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

fn IfStatement(test, consequent, alternate)

extends Node {

this.type = 'IfStatement';

this.test = test;
this.test.parent = this;

this.consequent = consequent;
this.consequent.parent = this;

this.alternate = alternate;

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

}

IfStatement.prototype.codegen = () -> {

if !super.codegen() {
  return;
}

this.test = this.test.codegen();
this.consequent = this.consequent.blockWrap().codegen();

if this.alternate? {
  this.alternate = this.alternate.blockWrap().codegen();
}

return this;

};

exports.IfStatement = IfStatement;