MCPcopy Index your code
hub / github.com/python/mypy / c_initializer_undefined_value

Method c_initializer_undefined_value

mypyc/codegen/emit.py:556–568  ·  view source on GitHub ↗

Undefined value represented in a form suitable for variable initialization.

(self, rtype: RType)

Source from the content-addressed store, hash-verified

554 return f"({rtuple.struct_name}) {self.c_initializer_undefined_value(rtuple)}"
555
556 def c_initializer_undefined_value(self, rtype: RType) -> str:
557 """Undefined value represented in a form suitable for variable initialization."""
558 if isinstance(rtype, RTuple):
559 if not rtype.types:
560 # Empty tuples contain a flag so that they can still indicate
561 # error values.
562 return f"{{ {int_rprimitive.c_undefined} }}"
563 items = ", ".join([self.c_initializer_undefined_value(t) for t in rtype.types])
564 return f"{{ {items} }}"
565 elif isinstance(rtype, RVec):
566 return "{ -1, NULL }"
567 else:
568 return self.c_undefined_value(rtype)
569
570 # Higher-level operations
571

Callers 2

tuple_undefined_valueMethod · 0.95
final_definitionMethod · 0.80

Calls 3

c_undefined_valueMethod · 0.95
isinstanceFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected