Sha256: 6089c3a767daa8c3158df77dbf9a498076c9809480668c8cff85b7955412cec2

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

$traceurRuntime.ModuleStore.getAnonymousModule(function() {
  "use strict";
  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 {};
});

//# sourceMappingURL=LogicalExpression.map

Version data entries

3 entries across 3 versions & 1 rubygems

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