Skip to content

Commit 6bad7c1

Browse files
committed
Use a simpler technique with fallthroughs for empty exception handler actions
1 parent a5c65df commit 6bad7c1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nmfu.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3915,11 +3915,11 @@ def convert(self, current_error_handlers):
39153915
handler_dfa = self.handler.convert(current_error_handlers)
39163916
sub_dfa.append_after(handler_dfa, sub_states=[self.handler_node], chain_actions=self.incoming_handler_actions)
39173917
else:
3918-
# Otherwise, just mark the handler as a finish state
3919-
sub_dfa.mark_accepting(self.handler_node)
3918+
# Otherwise, create a fallthrough dummy transition to hook up the handler actions.
3919+
dummy_end_node = DFState()
39203920
# And add the finish actions to everything that pointed at it
3921-
for trans in sub_dfa.transitions_pointing_to(self.handler_node):
3922-
trans.attach(*self.incoming_handler_actions)
3921+
self.handler_node.transition(DFTransition([DFTransition.Else], fallthrough=True).to(dummy_end_node).attach(*self.incoming_handler_actions))
3922+
sub_dfa.mark_accepting(dummy_end_node)
39233923

39243924
# If there is a next node, append it
39253925
if self.next is not None:

0 commit comments

Comments
 (0)