mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
Fixing Issue #643. Be a little bit safer about declaring block variables as close to the block scope as possible.
This commit is contained in:
@@ -1357,8 +1357,8 @@ exports.ForNode = class ForNode extends BaseNode
|
||||
scope = o.scope
|
||||
name = (@name and @name.compile(o)) or scope.freeVariable()
|
||||
index = @index and @index.compile o
|
||||
scope.find name if name and not @pattern and (range or not codeInBody)
|
||||
scope.find index if index
|
||||
scope.find(name, immediate: yes) if name and not @pattern and (range or not codeInBody)
|
||||
scope.find(index, immediate: yes) if index
|
||||
rvar = scope.freeVariable() unless topLevel
|
||||
ivar = if codeInBody then scope.freeVariable() else if range then name else index or scope.freeVariable()
|
||||
varPart = ''
|
||||
|
||||
Reference in New Issue
Block a user