Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #284 - Loops/comprehensions over decreasing ranges don't work #365

Merged
merged 2 commits into from
Apr 13, 2017

Conversation

basicer
Copy link
Contributor

@basicer basicer commented Apr 12, 2017

No description provided.

Copy link
Owner

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include tests for decreasing ranges using variable references for the left, right, and both sides. So

(a for a in [b..5])
(a for a in [5..b])
(a for a in [b..c])

Also, please add similar tests for exclusive ranges.

return what.data if what.instanceof CS.Int
return false unless what.instanceof CS.UnaryNegateOp
return false unless what.expression.instanceof CS.Int
return 0-what.expression.data
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space infix operators.

0 - what.expression.data


extractStaticRange = (range) ->
return undefined unless range.instanceof CS.Range
left = extractNumber(range.left)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop parens for function application.

extractNumber range.left

return undefined if left == false
return undefined if right == false

return [left,right]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space array elements.

[left, right]

- Add more unit tests for decreasing numeric ranges
@basicer
Copy link
Contributor Author

basicer commented Apr 13, 2017

@michaelficarra Updated 😄

Copy link
Owner

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@michaelficarra michaelficarra merged commit a122b37 into michaelficarra:master Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants