mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
removed useless property accesses from for-of
This commit is contained in:
@@ -1380,12 +1380,13 @@ exports.ForNode = class ForNode extends BaseNode
|
||||
source = if range then @source.base else @source
|
||||
codeInBody = @body.contains (n) -> n instanceof CodeNode
|
||||
scope = o.scope
|
||||
name = (@name and @name.compile(o)) or scope.freeVariable 'i'
|
||||
index = @index and @index.compile o
|
||||
name = @name ?.compile o
|
||||
index = @index?.compile o
|
||||
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 'result' unless topLevel
|
||||
ivar = if codeInBody then scope.freeVariable 'i' else if range then name else index or scope.freeVariable 'i'
|
||||
ivar = (if codeInBody then null else if range then name else index) or
|
||||
scope.freeVariable 'i'
|
||||
varPart = ''
|
||||
guardPart = ''
|
||||
body = Expressions.wrap([@body])
|
||||
|
||||
Reference in New Issue
Block a user