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

Method visit_load_literal

mypyc/codegen/emitfunc.py:347–354  ·  view source on GitHub ↗
(self, op: LoadLiteral)

Source from the content-addressed store, hash-verified

345 self.emit_line(f"{self.reg(op)} = {self.c_error_value(op.type)};")
346
347 def visit_load_literal(self, op: LoadLiteral) -> None:
348 index = self.literals.literal_index(op.value)
349 if not is_int_rprimitive(op.type):
350 self.emit_line("%s = CPyStatics[%d];" % (self.reg(op), index), ann=op.value)
351 else:
352 self.emit_line(
353 "%s = (CPyTagged)CPyStatics[%d] | 1;" % (self.reg(op), index), ann=op.value
354 )
355
356 def get_attr_expr(self, obj: str, op: GetAttr | SetAttr, decl_cl: ClassIR) -> str:
357 """Generate attribute accessor for normal (non-property) access.

Callers

nothing calls this directly

Calls 4

emit_lineMethod · 0.95
regMethod · 0.95
is_int_rprimitiveFunction · 0.90
literal_indexMethod · 0.80

Tested by

no test coverage detected