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

Method __init__

mypyc/ir/ops.py:663–679  ·  view source on GitHub ↗
(self, obj: Value, method: str, args: list[Value], line: int = -1)

Source from the content-addressed store, hash-verified

661 """Native method call obj.method(arg, ...)"""
662
663 def __init__(self, obj: Value, method: str, args: list[Value], line: int = -1) -> None:
664 self.obj = obj
665 self.method = method
666 self.args = args
667 assert isinstance(obj.type, RInstance), "Methods can only be called on instances"
668 self.receiver_type = obj.type
669 method_ir = self.receiver_type.class_ir.method_sig(method)
670 assert method_ir is not None, "{} doesn't have method {}".format(
671 self.receiver_type.name, method
672 )
673 ret_type = method_ir.ret_type
674 self.type = ret_type
675 if not ret_type.error_overlap:
676 self.error_kind = ERR_MAGIC
677 else:
678 self.error_kind = ERR_MAGIC_OVERLAPPING
679 super().__init__(line)
680
681 def sources(self) -> list[Value]:
682 return self.args.copy() + [self.obj]

Callers

nothing calls this directly

Calls 4

isinstanceFunction · 0.85
method_sigMethod · 0.80
formatMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected