| 736 | self.emit(f"GENERATE_ASDL_SEQ_CONSTRUCTOR({name}, {type})", depth=0) |
| 737 | |
| 738 | class PyTypesDeclareVisitor(PickleVisitor): |
| 739 | |
| 740 | def visitProduct(self, prod, name): |
| 741 | self.emit("static PyObject* ast2obj_%s(struct ast_state *state, void*);" % name, 0) |
| 742 | if prod.attributes: |
| 743 | self.emit("static const char * const %s_attributes[] = {" % name, 0) |
| 744 | for a in prod.attributes: |
| 745 | self.emit('"%s",' % a.name, 1) |
| 746 | self.emit("};", 0) |
| 747 | if prod.fields: |
| 748 | self.emit("static const char * const %s_fields[]={" % name,0) |
| 749 | for f in prod.fields: |
| 750 | self.emit('"%s",' % f.name, 1) |
| 751 | self.emit("};", 0) |
| 752 | |
| 753 | def visitSum(self, sum, name): |
| 754 | if sum.attributes: |
| 755 | self.emit("static const char * const %s_attributes[] = {" % name, 0) |
| 756 | for a in sum.attributes: |
| 757 | self.emit('"%s",' % a.name, 1) |
| 758 | self.emit("};", 0) |
| 759 | ptype = "void*" |
| 760 | if is_simple(sum): |
| 761 | ptype = get_c_type(name) |
| 762 | self.emit("static PyObject* ast2obj_%s(struct ast_state *state, %s);" % (name, ptype), 0) |
| 763 | for t in sum.types: |
| 764 | self.visitConstructor(t, name) |
| 765 | |
| 766 | def visitConstructor(self, cons, name): |
| 767 | if cons.fields: |
| 768 | self.emit("static const char * const %s_fields[]={" % cons.name, 0) |
| 769 | for t in cons.fields: |
| 770 | self.emit('"%s",' % t.name, 1) |
| 771 | self.emit("};",0) |
| 772 | |
| 773 | |
| 774 | class AnnotationsVisitor(PickleVisitor): |
no outgoing calls
no test coverage detected
searching dependent graphs…