JS: Add data-flow from yield in generators.#4134
Merged
codeql-ci merged 8 commits intogithub:mainfrom Sep 2, 2020
Merged
Conversation
yield in generators.yield in generators.
asgerf
reviewed
Sep 1, 2020
Contributor
asgerf
left a comment
There was a problem hiding this comment.
Looking good! Could you run a quick evaluation?
| predicate isAsync() { isAsync(this) } | ||
|
|
||
| /** Holds if this function is not asynchronous and also not a generator. */ | ||
| predicate isOrdinary() { not isAsync() and not isGenerator() } |
Contributor
There was a problem hiding this comment.
I'd say there are too many kinds of Function instances to have a predicate named isOrdinary. Implicit class constructors, abstract methods, bodiless functions in ambient context, function signatures etc, all seem non-ordinary in their own way.
I'd suggest isAsyncOrGenerator and then replacing the calls with not f.isAsyncOrGenerator()
| predicate localExceptionStepWithAsyncFlag(DataFlow::Node pred, DataFlow::Node succ, boolean async) { | ||
| exists(DataFlow::Node target | target = getThrowTarget(pred) | | ||
| async = false and | ||
| async = false and // this also covers generators - as the behavior of exceptions is close enough to the behavior of ordinary functions when it comes to exceptions (assuming that the iterator does not cross function boundaries). |
Contributor
There was a problem hiding this comment.
Break the comment into multiple lines
Contributor
Author
|
asgerf
approved these changes
Sep 2, 2020
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a followup to the support I added for async functions.