-
Notifications
You must be signed in to change notification settings - Fork 2k
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
using 'yield' automatically turns functions into generators #3240
Changes from all commits
f51cbd7
dafc7bd
9941050
f11ca98
7906a2b
d712a6c
74a92db
9d29a83
85c7fff
f4b850d
c02a403
e100020
56b04a5
dab4ae9
25b1eee
64e78a2
1e377ed
f375394
7590066
565d78f
c725566
437b9ed
781ea22
efca286
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
This is nowhere near sufficient to detect
yield
in the body. This assumes the function has a completely flat structure.f (yield 0), (yield 1)
will fail the test.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.
f (yield 0), (yield 1)
fails becauseyield
is used outside of a function definition. The parser works recursively, so nested structures will indeed pass the test. For example,x = -> f (yield 0), (yield 1)
works correctly.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 see,
@body.contains
walks the tree. I had thought it was shallow.