Code coverage report for lib/parser/ast/reference.js

Statements: 94.12% (16 / 17)      Branches: 66.67% (4 / 6)      Functions: 100% (2 / 2)      Lines: 94.12% (16 / 17)      Ignored: none     

All files » lib/parser/ast/ » reference.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 361   1   110 110 110 110 110   110     1       10 10 1         9   9       9       1  
var BaseExpression = require("./base");
 
function ReferenceExpression(path, bindingType) {
 
  this.path        = path;
  this.bindingType = bindingType;
  this.fast        = bindingType === "^";
  this.unbound     = ["~", "~>"].indexOf(bindingType) !== -1;
  this._isBoundTo  = ~["<~", "<~>", "~>"].indexOf(this.bindingType);
 
  BaseExpression.apply(this, arguments);
}
 
BaseExpression.extend(ReferenceExpression, {
  type: "reference",
  toJavaScript: function() {
 
    Eif (!this._isBoundTo)
    if (this.fast) {
      return "this.context." + this.path.join(".");
    }
 
    // var path = this.path.map(function(p) { return "'" + p + "'"; }).join(", ");
 
    var path = this.path.join(".");
 
    Iif (this._isBoundTo) {
      return "this.reference('" + path + "', " + (this.bindingType !== "<~") + ", " + (this.bindingType !== "~>") + ")";
    }
 
    return "this.get('" + path + "')";
  }
});
 
module.exports = ReferenceExpression;