MCPcopy Index your code
hub / github.com/apache/tvm / visit

Method visit

python/tvm/script/parser/core/parser.py:638–667  ·  view source on GitHub ↗

The general visiting method. Parameters ---------- node : doc.AST The doc AST node. Returns ------- res : Any The visiting result.

(self, node: doc.AST)

Source from the content-addressed store, hash-verified

636 raise diag_err
637
638 def visit(self, node: doc.AST) -> None:
639 """The general visiting method.
640
641 Parameters
642 ----------
643 node : doc.AST
644 The doc AST node.
645
646 Returns
647 -------
648 res : Any
649 The visiting result.
650 """
651 if isinstance(node, list | tuple):
652 for item in node:
653 self.visit(item)
654 return
655 if not isinstance(node, doc.AST):
656 return
657 name = node.__class__.__name__.split(".")[-1]
658 if name in DEFAULT_VISIT:
659 func = self.generic_visit
660 else:
661 func = getattr(self, "visit_" + name, None)
662 if func is None:
663 raise NotImplementedError(f"Visitor of AST node is not implemented: {name}")
664 try:
665 func(node)
666 except Exception as err: # pylint: disable=broad-except
667 self.report_error(node, err)
668
669 def visit_body(self, node: list[doc.stmt]) -> Any:
670 """The general body visiting method.

Callers 3

parseMethod · 0.95
visit_bodyMethod · 0.95
_visit_class_defFunction · 0.45

Calls 3

report_errorMethod · 0.95
funcFunction · 0.70
splitMethod · 0.45

Tested by

no test coverage detected