MCPcopy Index your code
hub / github.com/python/cpython / visitSum

Method visitSum

Parser/asdl_c.py:1921–1934  ·  view source on GitHub ↗
(self, sum, name)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 6

emit_defaultsMethod · 0.95
visitConstructorMethod · 0.95
reflow_c_stringFunction · 0.85
asdl_ofFunction · 0.85
is_simpleFunction · 0.85
emitMethod · 0.45

Tested by

no test coverage detected