From 85684412214b5c4c159e59c60da540d185518666 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 27 Sep 2010 22:17:46 -0400 Subject: [PATCH] merging in satyr's fix for #653 --- lib/nodes.js | 4 ++-- src/nodes.coffee | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/nodes.js b/lib/nodes.js index 48cd3a1d..00c438dc 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -57,7 +57,7 @@ var compiled, pair, reference; options || (options = {}); pair = (function() { - if (!(this.isComplex())) { + if (!this.isComplex()) { return [this, this]; } else if (this instanceof ValueNode && options.assignment) { return this.cacheIndexes(o); @@ -697,7 +697,7 @@ vars = this.compileVariables(merge(o, { indent: idt })); - if (this.fromNum && this.toNum && (Math.abs(+this.fromNum - +this.toNum) <= 20)) { + if (this.fromNum && this.toNum && (Math.abs(this.fromNum - this.toNum) <= 20)) { range = (function() { _result = []; _ref2 = +this.fromNum; _ref3 = +this.toNum; for (var _i = _ref2; _ref2 <= _ref3 ? _i <= _ref3 : _i >= _ref3; _ref2 <= _ref3 ? _i += 1 : _i -= 1){ _result.push(_i); } diff --git a/src/nodes.coffee b/src/nodes.coffee index 4e6581e1..d4a51965 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -8,6 +8,7 @@ # Import the helpers we plan to use. {compact, flatten, merge, del, include, indexOf, starts, ends} = require './helpers' +# Constant functions for nodes that don't need customization. YES = -> yes NO = -> no @@ -62,7 +63,7 @@ exports.BaseNode = class BaseNode # by assigning it to a temporary variable. compileReference: (o, options) -> options or= {} - pair = unless @isComplex() + pair = if not @isComplex() [this, this] else if this instanceof ValueNode and options.assignment this.cacheIndexes(o)