fixing range literals (which had gone untested) oops.

This commit is contained in:
Jeremy Ashkenas
2010-06-28 20:26:31 -04:00
parent 744638ed08
commit 7c426db36a
3 changed files with 23 additions and 10 deletions

View File

@@ -525,11 +525,13 @@ exports.RangeNode: class RangeNode extends BaseNode
equals: if @exclusive then '' else '='
from: @fromVar.compile o
to: @toVar.compile o
result: o.scope.freeVariable()
i: o.scope.freeVariable()
clause: "$from <= $to ?"
pre: "\n${idt}a = [];${vars}"
body: "var i = $from; ($clause i <$equals $to : i >$equals $to); ($clause i += 1 : i -= 1)"
post: "a.push(i);\n${idt}return a;\n$o.indent"
"(function(){${pre}for ($body) $post}).call(this)"
pre: "\n${idt}${result} = [];${vars}"
body: "var $i = $from; $clause $i <$equals $to : $i >$equals $to; $clause $i += 1 : $i -= 1"
post: "{ ${result}.push($i) };\n${idt}return $result;\n$o.indent"
"(function(){${pre};\n${idt}for ($body)$post}).call(this)"
#### SliceNode