@@ -34,44 +34,44 @@ def _convert_block(statements: List[Tree], context: Context) -> List[str]:
34
34
def _convert_statement (statement : Tree , context : Context ) -> List [str ]:
35
35
handlers = {
36
36
# class statements:
37
- "tool_stmt " : _ignore ,
37
+ "annotation " : _ignore ,
38
38
"pass_stmt" : lambda s , c : [f"{ c .indent_string } pass" ],
39
39
"class_var_stmt" : _convert_first_child_as_statement ,
40
- "var_empty" : lambda s , c : [f"{ c .indent_string } { s .children [0 ].value } = None" ],
41
- "var_assigned" : _convert_var_statement_with_expression ,
42
- "var_typed" : lambda s , c : [f"{ c .indent_string } { s .children [0 ].value } = None" ],
43
- "var_typed_assgnd" : _convert_var_statement_with_expression ,
44
- "var_inf" : _convert_var_statement_with_expression ,
45
- "extends_stmt" : _ignore ,
40
+ "class_var_empty" : lambda s , c : [
41
+ f"{ c .indent_string } { s .children [0 ].value } = None"
42
+ ],
43
+ "class_var_assigned" : _convert_var_statement_with_expression ,
44
+ "class_var_typed" : lambda s , c : [
45
+ f"{ c .indent_string } { s .children [0 ].value } = None"
46
+ ],
47
+ "class_var_typed_assgnd" : _convert_var_statement_with_expression ,
48
+ "class_var_inf" : _convert_var_statement_with_expression ,
49
+ "extends_stmt" : _pass ,
46
50
"class_def" : _convert_class_def ,
47
51
"func_def" : _convert_func_def ,
48
- "enum_def" : _ignore , # TODO: implement
49
- "classname_stmt" : _ignore ,
50
- "classname_extends_stmt" : _ignore ,
51
- "signal_stmt" : _ignore ,
52
- "docstr_stmt" : lambda s , c : [
53
- f"{ c .indent_string } { s .children [0 ].children [0 ].value } "
54
- ],
52
+ "enum_stmt" : _pass , # TODO: implement
53
+ "classname_stmt" : _pass ,
54
+ "classname_extends_stmt" : _pass ,
55
+ "signal_stmt" : _pass ,
55
56
"const_stmt" : lambda s , c : [
56
57
"{}{} = {}" .format (
57
58
c .indent_string ,
58
59
s .children [1 ].value ,
59
60
_convert_expression_to_str (s .children [- 1 ]),
60
61
)
61
62
],
62
- "export_stmt" : _convert_export_statement ,
63
- "onready_stmt" : lambda s , c : _convert_statement (s .children [- 1 ], c ),
64
- "puppet_var_stmt" : _convert_first_child_as_statement ,
65
63
"static_func_def" : _convert_first_child_as_statement ,
66
- "remote_func_def" : _convert_first_child_as_statement ,
67
- "remotesync_func_def" : _convert_first_child_as_statement ,
68
- "master_func_def" : _convert_first_child_as_statement ,
69
- "mastersync_func_def" : _convert_first_child_as_statement ,
70
- "puppet_func_def" : _convert_first_child_as_statement ,
71
- "puppetsync_func_def" : _convert_first_child_as_statement ,
72
- "sync_func_def" : _convert_first_child_as_statement ,
73
64
# func statements:
74
65
"func_var_stmt" : _convert_first_child_as_statement ,
66
+ "func_var_empty" : lambda s , c : [
67
+ f"{ c .indent_string } { s .children [0 ].value } = None"
68
+ ],
69
+ "func_var_assigned" : _convert_var_statement_with_expression ,
70
+ "func_var_typed" : lambda s , c : [
71
+ f"{ c .indent_string } { s .children [0 ].value } = None"
72
+ ],
73
+ "func_var_typed_assgnd" : _convert_var_statement_with_expression ,
74
+ "func_var_inf" : _convert_var_statement_with_expression ,
75
75
"expr_stmt" : _convert_first_child_as_statement ,
76
76
"expr" : lambda s , c : [
77
77
f"{ c .indent_string } { _convert_expression_to_str (s .children [0 ])} "
@@ -106,7 +106,11 @@ def _convert_statement(statement: Tree, context: Context) -> List[str]:
106
106
return handlers [statement .data ](statement , context )
107
107
108
108
109
- def _ignore (_statement : Node , context : Context ) -> List [str ]:
109
+ def _ignore (_statement : Node , _context : Context ) -> List [str ]:
110
+ return []
111
+
112
+
113
+ def _pass (_statement : Node , context : Context ) -> List [str ]:
110
114
return [f"{ context .indent_string } pass" ]
111
115
112
116
0 commit comments