Coverage for skema/program_analysis/CAST2FN/visitors/cast_visitor.py: 83%

12 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1import typing 

2from functools import singledispatchmethod 

3 

4from skema.program_analysis.CAST2FN.model.cast import ( 

5 AstNode, 

6) 

7from skema.program_analysis.CAST2FN.model.cast_to_air_model import ( 

8 C2ATypeError, 

9) 

10 

11 

12class CASTVisitor: 

13 def __init__(self): 

14 pass 

15 

16 def visit_list(self, node_list: typing.List[AstNode]): 

17 return [self.visit(n) for n in node_list] 

18 

19 @singledispatchmethod 

20 def visit(self, node: AstNode): 

21 raise C2ATypeError(f"Unimplemented AST node of type: {type(node)}")