Sha256: 28ffd8c04021aa39fbb497f878ae5d6786c38703f0bede06205cd6f69cdc2901

Contents?: true

Size: 811 Bytes

Versions: 3

Compression:

Stored size: 811 Bytes

Contents

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;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spider-src-0.1.7 lib/spider-src/support/spider/src/ast/statements/ForStatement.spider
spider-src-0.1.6 lib/spider-src/support/spider/src/ast/statements/ForStatement.spider
spider-src-0.1.5 lib/spider-src/support/spider/src/ast/statements/ForStatement.spider