Sha256: e83b114efa91f5d99ab79835336958651497af355d33faaa9325e971d8da0626

Contents?: true

Size: 970 Bytes

Versions: 3

Compression:

Stored size: 970 Bytes

Contents

use :node;

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

fn SplatExpression(expression)
  extends Node {
  
  this.type = 'SplatExpression';
  
  this.expression = expression;
  this.expression.parent = this;
}

SplatExpression.prototype.codegen = () -> {
  if !super.codegen() {
    return;
  }
  
  this.expression = this.expression.codegen();
  
  return {
    "type": "CallExpression",
    "callee": {
      "type": "MemberExpression",
      "computed": false,
      "object": {
        "type": "MemberExpression",
        "computed": false,
        "object": {
          "type": "ArrayExpression",
          "elements": []
        },
        "property": {
          "type": "Identifier",
          "name": "slice"
        }
      },
      "property": {
        "type": "Identifier",
        "name": "call"
      }
    },
    "arguments": [this.expression]
  };
};

SplatExpression.prototype.hasCallExpression = () -> true;

exports.SplatExpression = SplatExpression;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spider-src-0.1.7 lib/spider-src/support/spider/src/ast/expressions/SplatExpression.spider
spider-src-0.1.6 lib/spider-src/support/spider/src/ast/expressions/SplatExpression.spider
spider-src-0.1.5 lib/spider-src/support/spider/src/ast/expressions/SplatExpression.spider