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

Method simpleSum

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

Source from the content-addressed store, hash-verified

530 self.emit("", 0)
531
532 def simpleSum(self, sum, name):
533 self.funcHeader(name)
534 for t in sum.types:
535 line = ("isinstance = PyObject_IsInstance(obj, "
536 "state->%s_type);")
537 self.emit(line % (t.name,), 1)
538 self.emit("if (isinstance == -1) {", 1)
539 self.emit("return -1;", 2)
540 self.emit("}", 1)
541 self.emit("if (isinstance) {", 1)
542 self.emit("*out = %s;" % t.name, 2)
543 self.emit("return 0;", 2)
544 self.emit("}", 1)
545 self.sumTrailer(name)
546
547 def buildArgs(self, fields):
548 return ", ".join(fields + ["arena"])

Callers 1

visitSumMethod · 0.95

Calls 3

funcHeaderMethod · 0.95
sumTrailerMethod · 0.95
emitMethod · 0.45

Tested by

no test coverage detected