use :node;

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

fn UntilStatement(test, body)

extends Node {

this.type = 'UntilStatement';

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

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

}

UntilStatement.prototype.codegen = () -> {

if !super.codegen() {
  return;
}

this.type = 'WhileStatement';

this.test = {
  "type": "UnaryExpression",
  "operator": "!",
  "argument": this.test.codegen(),
  "prefix": true
};

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

return this;

};

exports.UntilStatement = UntilStatement;