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

Function generate_dispatch_glue_native_function

mypyc/irbuild/function.py:1076–1092  ·  view source on GitHub ↗
(
    builder: IRBuilder, fitem: FuncDef, callable_class_decl: FuncDecl, dispatch_name: str
)

Source from the content-addressed store, hash-verified

1074
1075
1076def generate_dispatch_glue_native_function(
1077 builder: IRBuilder, fitem: FuncDef, callable_class_decl: FuncDecl, dispatch_name: str
1078) -> FuncIR:
1079 line = fitem.line
1080 builder.enter()
1081 # We store the callable class in the globals dict for this function
1082 callable_class = builder.load_global_str(dispatch_name, line)
1083 decl = builder.mapper.func_to_decl[fitem]
1084 arg_info = get_args(builder, decl.sig.args, line)
1085 args = [callable_class] + arg_info.args
1086 arg_kinds = [ArgKind.ARG_POS] + arg_info.arg_kinds
1087 arg_names = arg_info.arg_names
1088 arg_names.insert(0, "self")
1089 ret_val = builder.builder.call(callable_class_decl, args, arg_kinds, arg_names, line)
1090 builder.add(Return(ret_val))
1091 arg_regs, _, blocks, _, fn_info = builder.leave()
1092 return FuncIR(decl, arg_regs, blocks)
1093
1094
1095def generate_singledispatch_callable_class_ctor(builder: IRBuilder) -> None:

Callers 1

gen_dispatch_func_irFunction · 0.85

Calls 9

ReturnClass · 0.90
FuncIRClass · 0.90
get_argsFunction · 0.85
load_global_strMethod · 0.80
insertMethod · 0.80
callMethod · 0.80
leaveMethod · 0.80
enterMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…