use a temp var for range expansion, instead of 'i'

This commit is contained in:
Jeremy Ashkenas
2010-02-16 08:58:29 -05:00
parent a3c8c0b492
commit 79fa4723ab
2 changed files with 7 additions and 5 deletions

View File

@@ -450,8 +450,9 @@ RangeNode: exports.RangeNode: inherit Node, {
# part of a comprehension, slice, or splice.
# TODO: This generates pretty ugly code ... shrink it.
compile_array: (o) ->
body: Expressions.wrap([new LiteralNode('i')])
arr: Expressions.wrap([new ForNode(body, {source: (new ValueNode(this))}, new LiteralNode('i'))])
name: o.scope.free_variable()
body: Expressions.wrap([new LiteralNode(name)])
arr: Expressions.wrap([new ForNode(body, {source: (new ValueNode(this))}, new LiteralNode(name))])
(new ParentheticalNode(new CallNode(new CodeNode([], arr)))).compile(o)
}