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

Method visit_ClassDef

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

Source from the content-addressed store, hash-verified

664 self.builder.add_continue_node(node, try_node, guards)
665
666 def visit_ClassDef(self, node):
667 # We also keep the ClassDef node in the CFG, since it technically is a
668 # statement.
669 # For example, this is legal and allows executing user code:
670 #
671 # class Foo(bar()):
672 # pass
673 #
674 # It also has a scope:
675 #
676 # class Bar(object):
677 # a = 1
678 if self.builder is None:
679 self.generic_visit(node)
680 return
681
682 self.builder.add_ordinary_node(node)
683
684 self.builder_stack.append(self.builder)
685 self.builder = GraphBuilder(node)
686 self._enter_lexical_scope(node)
687
688 self._process_basic_statement(node)
689
690 self._exit_lexical_scope(node)
691 # TODO(mdan): Track the CFG local to the class definition as well?
692 self.builder = self.builder_stack.pop()
693
694 def visit_FunctionDef(self, node):
695 # We also keep the FunctionDef node in the CFG. This allows us to determine

Callers

nothing calls this directly

Calls 8

_enter_lexical_scopeMethod · 0.95
_exit_lexical_scopeMethod · 0.95
add_ordinary_nodeMethod · 0.80
GraphBuilderClass · 0.70
generic_visitMethod · 0.45
appendMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected