-
Notifications
You must be signed in to change notification settings - Fork 9
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
SwitchExtractor Improvement #424
Conversation
self._current_cond_node.clean() | ||
|
||
def _try_to_extract_switch_from_branch(self, branch: Union[TrueNode, FalseNode]) -> None: | ||
def _switch_can_be_extracted(self, switch_node: SwitchNode) -> bool: |
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 think the function name is a bit misleading, indicating that it is only checked if the extraction is possible or not. Instead, the extraction is actually performed.
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.
renamed
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.
Well, I still don't particularly like the naming, but sure :D
self.asforest.extract_branch_from_condition_node(self._current_cond_node, branch, False) | ||
self.asforest.extract_branch_from_condition_node(condition_node, branch, False) | ||
|
||
def _extract_switch_from_first_or_last_child_of(self, sequence_node: SeqNode, condition: LogicCondition) -> bool: |
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.
btw. and regarding my above comment: Here you are also returning True/False in case of succeeded or failed extraction without the function being names as above
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.
renamed
First, the switch-extractor did not consider sequence nodes with a non-trivial reaching-condition. Therefore, we did not extract some switches leading to fewer cases or not the ability to merge cases.
Second, there was a minor bug, because we extracted switches from conditions nodes even if they were children of a sequence node with a non-trivial reaching-condition.