| 101 | |
| 102 | def test_visitor(self): |
| 103 | class CustomVisitor(self.asdl.VisitorBase): |
| 104 | def __init__(self): |
| 105 | super().__init__() |
| 106 | self.names_with_seq = [] |
| 107 | |
| 108 | def visitModule(self, mod): |
| 109 | for dfn in mod.dfns: |
| 110 | self.visit(dfn) |
| 111 | |
| 112 | def visitType(self, type): |
| 113 | self.visit(type.value) |
| 114 | |
| 115 | def visitSum(self, sum): |
| 116 | for t in sum.types: |
| 117 | self.visit(t) |
| 118 | |
| 119 | def visitConstructor(self, cons): |
| 120 | for f in cons.fields: |
| 121 | if f.seq: |
| 122 | self.names_with_seq.append(cons.name) |
| 123 | |
| 124 | v = CustomVisitor() |
| 125 | v.visit(self.types['mod']) |
no outgoing calls
searching dependent graphs…