-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Ruby: Desugar for
loops as calls to each
#7098
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
04df56d
Support synthesis of `SimpleParameter`s
alexrford a743067
Support synthesis of blocks (without a new variable scope)
alexrford f6d99dc
Define `getBlockImpl` for synthesized method calls
alexrford ddfcfc9
Desugar `for` loops as `each` calls
alexrford e468434
ruby: drop special handling of for-in loops in the CFG
alexrford 8603609
Update test output to account for for-loop -> each desugaring
alexrford db6f843
Ruby: Hide `SynthBlock` from the public API
hvitved 48e6bdb
Ruby: Remove `EmptinessCompletion`
hvitved 028ef6f
Ruby: Handle synthesized scopes
hvitved 135ee0d
Ruby: Add implicit writes for synthesized parameters
hvitved a62ad50
Ruby: Make `isCapturedAccess` work with synthesized scopes
hvitved 945bb74
Ruby: Update expected test output
hvitved 92453bd
Ruby: Rewrite `break_ensure.rb` CFG test to use `while` loops instead…
hvitved 9125b85
Ruby: Add missing QL doc
hvitved 4133759
Ruby: Flatten nested statements inside desugared `for` loops
hvitved 08c7782
Ruby: Adopt to changes after rebase
hvitved 9ff63b0
Ruby: Remove CFG dependency from AST stage
hvitved de72a76
Ruby: Update expected CFG test output (reordering)
hvitved a4538de
Shared CFG: Rename `TNode` to `TCfgNode`
hvitved File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this line needed? (Maybe add a comment?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it is not needed, since a module cannot be inside a method (right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like singleton classes can be inside methods. Here's one example I found: https://github.com/gitlabhq/gitlabhq/blob/94ecc00f47df7051eea905a5899053bf476e0589/app/services/users/signup_service.rb#L27-L32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A module can be created in the body of a method, however, from a scope point of view the method and the module are unrelated.