Cleaning up.

This commit is contained in:
Stan Angeloff
2010-04-26 21:54:31 +03:00
parent 2a3a713811
commit 76f9596f22
2 changed files with 8 additions and 8 deletions

View File

@@ -1079,10 +1079,10 @@ exports.ForNode: class ForNode extends BaseNode
@step: source.step
@object: !!source.object
[@name, @index]: [@index, @name] if @object
@pattern: @name instanceof ValueNode
throw new Error('index cannot be a pattern matching expression') if @index instanceof ObjectNode
@pattern: @name instanceof ValueNode
throw new Error('index cannot be a pattern matching expression') if @index instanceof ValueNode
@children: compact [@body, @source, @filter]
@returns: false
@returns: false
top_sensitive: ->
true
@@ -1122,11 +1122,12 @@ exports.ForNode: class ForNode extends BaseNode
svar: scope.free_variable()
index_var: null
source_part: "$svar = ${ @source.compile(o) };\n$@tab"
var_part: "$body_dent$name = $svar[$ivar];\n" if name and not @pattern
if @pattern
o.indent: @idt 1
o.top: true
var_part: new AssignNode(@name, literal("$svar[$ivar]")).compile(o) + "\n"
else
var_part: "$body_dent$name = $svar[$ivar];\n" if name
if not @object
lvar: scope.free_variable()
step_part: if @step then "$ivar += ${ @step.compile(o) }" else "$ivar++"