Sha256: b53e9c9d2c1e46ed72ea65ddda6f593a11cb0c9c655b84af86490cb6023dbae2

Contents?: true

Size: 724 Bytes

Versions: 3

Compression:

Stored size: 724 Bytes

Contents

use :node;

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

fn PushStatement(left, right)
  extends Node {
  
  this.type = 'PushStatement';
  
  this.left = left;
  this.left.parent = this;

  this.right = right;
  this.right.parent = this;  
}

PushStatement.prototype.codegen = () -> {
  if !super.codegen() {
    return;
  }
    
  this.type = "ExpressionStatement";
  this.expression = {
    "type": "CallExpression",
    "callee": {
      "type": "MemberExpression",
      "object": this.left.codegen(),
      "property": {
        "type": "Identifier",
        "name": "push"
      },
      "computed": false
    },
    "arguments": [this.right.codegen()]
  };
  
  return this;
};

exports.PushStatement = PushStatement;

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/PushStatement.spider
spider-src-0.1.6 lib/spider-src/support/spider/src/ast/statements/PushStatement.spider
spider-src-0.1.5 lib/spider-src/support/spider/src/ast/statements/PushStatement.spider