Sha256: 8805b3749547b0e11cce90484819d78814fed59664d288ceaa29ac5f229ab47e

Contents?: true

Size: 1.84 KB

Versions: 1

Compression:

Stored size: 1.84 KB

Contents

System.register("LogicalExpression", [], function() {
  "use strict";
  var __moduleName = "LogicalExpression";
  function require(path) {
    return $traceurRuntime.require("LogicalExpression", path);
  }
  "use strict";
  (function() {
    var Node = module.require("../Node").Node;
    function LogicalExpression(left, operator, right) {
      Node.call(this);
      this.type = "LogicalExpression";
      this.operator = operator;
      if (this.operator === "and") {
        this.operator = "&&";
      } else if (this.operator === "or") {
        this.operator = "||";
      }
      this.left = left;
      this.left.parent = this;
      this.right = right;
      this.right.parent = this;
    }
    LogicalExpression.prototype = Object.create(Node);
    LogicalExpression.prototype.codegen = function() {
      if (!Node.prototype.codegen.call(this)) {
        return;
      }
      var enforceBooleanExpression = function(o) {
        if (!!(o.type === "UnaryExpression") && !!(o.operator === "!")) {
          return o;
        }
        return {
          "type": "UnaryExpression",
          "operator": "!",
          "argument": {
            "type": "UnaryExpression",
            "operator": "!",
            "argument": o,
            "prefix": true
          },
          "prefix": true
        };
      };
      this.left = enforceBooleanExpression(this.left.codegen());
      this.right = enforceBooleanExpression(this.right.codegen());
      return this;
    };
    LogicalExpression.prototype.hasCallExpression = function() {
      return !!(typeof this.left !== "undefined" && this.left !== null ? this.left.hasCallExpression() : void 0) || !!(typeof this.right !== "undefined" && this.right !== null ? this.right.hasCallExpression() : void 0);
    };
    exports.LogicalExpression = LogicalExpression;
  }());
  return {};
});
System.get("LogicalExpression" + '');

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spider-src-0.1.6 lib/spider-src/support/spider/node_modules/spider-script/lib/ast/expressions/LogicalExpression.js