(self, sum, name)
| 1919 | self.emit_defaults(name, prod.attributes, 1) |
| 1920 | |
| 1921 | def visitSum(self, sum, name): |
| 1922 | self.emit('state->%s_type = make_type(state, "%s", state->AST_type, NULL, 0,' % |
| 1923 | (name, name), 1) |
| 1924 | self.emit('%s);' % reflow_c_string(asdl_of(name, sum), 2), 2, reflow=False) |
| 1925 | self.emit("if (!state->%s_type) return -1;" % name, 1) |
| 1926 | if sum.attributes: |
| 1927 | self.emit("if (add_attributes(state, state->%s_type, %s_attributes, %d) < 0) return -1;" % |
| 1928 | (name, name, len(sum.attributes)), 1) |
| 1929 | else: |
| 1930 | self.emit("if (add_attributes(state, state->%s_type, NULL, 0) < 0) return -1;" % name, 1) |
| 1931 | self.emit_defaults(name, sum.attributes, 1) |
| 1932 | simple = is_simple(sum) |
| 1933 | for t in sum.types: |
| 1934 | self.visitConstructor(t, name, simple) |
| 1935 | |
| 1936 | def visitConstructor(self, cons, name, simple): |
| 1937 | if cons.fields: |
nothing calls this directly
no test coverage detected