-
Notifications
You must be signed in to change notification settings - Fork 356
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
Add support for switch expressions in dataflow #4982
Add support for switch expressions in dataflow #4982
Conversation
…dataflow # Conflicts: # dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Missing javadoc is in NodeVisitor, which had no javadoc on methods, so I'm not adding any.
…-framework into switch-expressions-check
…ck into switch-expressions-dataflow
SKIP-REQUIRE-JAVADOC
Outdated
@@ -0,0 +1 @@ | |||
Delete after merge. |
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 file necessary? I don't see wide-ranging uninteresting edits in this pull request.
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.
The problem is that NodeVisitor has 80 undocumented methods. I would have to document them all to get the Javadoc test to pass. See https://github.com/typetools/checker-framework/runs/4509004521.
dataflow/src/main/java/org/checkerframework/dataflow/cfg/node/SwitchExpressionNode.java
Outdated
Show resolved
Hide resolved
dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Outdated
Show resolved
Hide resolved
* Build up the CFG for the switchTree. | ||
* | ||
* @return if the switch is a switch expression, then a {@link SwitchExpressionNode}; otherwise, | ||
* null |
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 that the right thing? I guess probably because elsewhere builds all the CFG nodes for the case bodies and none is needed explicitly for the switch statement itself.
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.
That's right. A switch statement does not have a value so it doesn't need to have a corresponding node.
dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Outdated
Show resolved
Hide resolved
dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Outdated
Show resolved
Hide resolved
dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Outdated
Show resolved
Hide resolved
dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Outdated
Show resolved
Hide resolved
They are analyzed the same as switch statements, except that dataflow adds adds an assignment between each result expression and a dataflow-created variable at each yield statement or expression that is a result expression. The value of that dataflow-created variable is the value of the switch expression.
They are analyzed the same as switch statements, except that dataflow adds adds an assignment between each result expression and a dataflow-created variable at each yield statement or expression that is a result expression. The value of that dataflow-created variable is the value of the switch expression.
This includes #4978, merge that one first.Delete SKIP-REQUIRE-JAVADOC after merging!
Fixes #2373 and fixes #4979.