use a temp var for range expansion, instead of 'i'
This commit is contained in:
parent
a3c8c0b492
commit
79fa4723ab
|
@ -526,11 +526,12 @@
|
|||
// part of a comprehension, slice, or splice.
|
||||
// TODO: This generates pretty ugly code ... shrink it.
|
||||
compile_array: function compile_array(o) {
|
||||
var arr, body;
|
||||
body = Expressions.wrap([new LiteralNode('i')]);
|
||||
var arr, body, name;
|
||||
name = o.scope.free_variable();
|
||||
body = Expressions.wrap([new LiteralNode(name)]);
|
||||
arr = Expressions.wrap([new ForNode(body, {
|
||||
source: (new ValueNode(this))
|
||||
}, new LiteralNode('i'))
|
||||
}, new LiteralNode(name))
|
||||
]);
|
||||
return (new ParentheticalNode(new CallNode(new CodeNode([], arr)))).compile(o);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue