mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
ForBody is really the ForSource
This commit is contained in:
@@ -318,15 +318,17 @@ rule
|
||||
# Array comprehensions, including guard and current index.
|
||||
For:
|
||||
Expression FOR
|
||||
ForVariables ForBody { result = ForNode.new(val[0], val[3][0], val[2][0], val[3][1], val[2][1]) }
|
||||
ForVariables ForSource { result = ForNode.new(val[0], val[3][0], val[2][0], val[3][1], val[2][1]) }
|
||||
;
|
||||
|
||||
# An array comprehension has variables for the current element and index.
|
||||
ForVariables:
|
||||
IDENTIFIER { result = val }
|
||||
| IDENTIFIER "," IDENTIFIER { result = [val[0], val[2]] }
|
||||
;
|
||||
|
||||
ForBody:
|
||||
# The source of the array comprehension can optionally be filtered.
|
||||
ForSource:
|
||||
IN PureExpression "." { result = [val[1]] }
|
||||
| IN PureExpression
|
||||
IF Expression "." { result = [val[1], val[3]] }
|
||||
|
||||
Reference in New Issue
Block a user