@@ -35,11 +35,17 @@ def _visit_class_def(self: Parser, node: doc.ClassDef) -> None:
3535
3636 with self .var_table .with_frame ():
3737 with I .ir_module ():
38+ with self .with_dispatch_token ("ir" ):
39+ for stmt in node .body :
40+ if not isinstance (stmt , doc .FunctionDef ):
41+ self .visit (stmt )
3842 for stmt in node .body :
3943 if isinstance (stmt , doc .FunctionDef ):
4044 self .visit_tvm_declare_function (stmt )
4145 with self .with_dispatch_token ("ir" ):
42- self .visit_body (node .body )
46+ for stmt in node .body :
47+ if isinstance (stmt , doc .FunctionDef ):
48+ self .visit (stmt )
4349
4450
4551@dispatch .register (token = "ir" , type_name = "Assign" )
@@ -57,7 +63,7 @@ def _visit_assign(_self: Parser, _node: doc.Assign) -> None:
5763
5864
5965@dispatch .register (token = "ir" , type_name = "Expr" )
60- def _visit_expr (_self : Parser , _node : doc .Expr ) -> None :
66+ def _visit_expr (self : Parser , node : doc .Expr ) -> None :
6167 """The expression visiting method for ir module.
6268
6369 Parameters
@@ -68,6 +74,7 @@ def _visit_expr(_self: Parser, _node: doc.Expr) -> None:
6874 node : doc.ClassDef
6975 The doc AST expression node.
7076 """
77+ self .eval_expr (node .value )
7178
7279
7380@dispatch .register (token = "default" , type_name = "Assign" )
0 commit comments