MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / visit_Try

Method visit_Try

tensorflow/python/autograph/pyct/cfg.py:846–886  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

844 self.builder.end_statement(node)
845
846 def visit_Try(self, node):
847 self.builder.begin_statement(node)
848 self._enter_lexical_scope(node)
849
850 # Note: the current simplification is that the try block fully executes
851 # regardless of whether an exception triggers or not. This is consistent
852 # with blocks free of try/except, which also don't account for the
853 # possibility of an exception being raised mid-block.
854
855 for stmt in node.body:
856 self.visit(stmt)
857 # The orelse is an optional continuation of the body.
858 if node.orelse:
859 block_representative = node.orelse[0]
860 self.builder.enter_cond_section(block_representative)
861 self.builder.new_cond_branch(block_representative)
862 for stmt in node.orelse:
863 self.visit(stmt)
864 self.builder.new_cond_branch(block_representative)
865 self.builder.exit_cond_section(block_representative)
866
867 self._exit_lexical_scope(node)
868
869 if node.handlers:
870 # Using node would be inconsistent. Using the first handler node is also
871 # inconsistent, but less so.
872 block_representative = node.handlers[0]
873 self.builder.enter_cond_section(block_representative)
874 for block in node.handlers:
875 self.builder.new_cond_branch(block_representative)
876 self.visit(block)
877 self.builder.new_cond_branch(block_representative)
878 self.builder.exit_cond_section(block_representative)
879
880 if node.finalbody:
881 self.builder.enter_finally_section(node)
882 for stmt in node.finalbody:
883 self.visit(stmt)
884 self.builder.exit_finally_section(node)
885
886 self.builder.end_statement(node)
887
888 def visit_With(self, node):
889 # TODO(mdan): Mark the context manager's exit call as exit guard.

Callers

nothing calls this directly

Calls 10

_enter_lexical_scopeMethod · 0.95
_exit_lexical_scopeMethod · 0.95
begin_statementMethod · 0.80
enter_cond_sectionMethod · 0.80
new_cond_branchMethod · 0.80
exit_cond_sectionMethod · 0.80
enter_finally_sectionMethod · 0.80
exit_finally_sectionMethod · 0.80
end_statementMethod · 0.80
visitMethod · 0.45

Tested by

no test coverage detected