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

Function transform_lambda_expr

mypyc/irbuild/function.py:141–161  ·  view source on GitHub ↗
(builder: IRBuilder, expr: LambdaExpr)

Source from the content-addressed store, hash-verified

139
140
141def transform_lambda_expr(builder: IRBuilder, expr: LambdaExpr) -> Value:
142 typ = get_proper_type(builder.types[expr])
143 assert isinstance(typ, CallableType), typ
144
145 runtime_args = []
146 for arg, arg_type in zip(expr.arguments, typ.arg_types):
147 arg.variable.type = arg_type
148 runtime_args.append(
149 RuntimeArg(arg.variable.name, builder.type_to_rtype(arg_type), arg.kind)
150 )
151 ret_type = builder.type_to_rtype(typ.ret_type)
152
153 fsig = FuncSignature(runtime_args, ret_type)
154
155 fname = f"{LAMBDA_NAME}{builder.lambda_counter}"
156 builder.lambda_counter += 1
157 func_ir, func_reg = gen_func_item(builder, expr, fname, fsig)
158 assert func_reg is not None
159
160 builder.functions.append(func_ir)
161 return func_reg
162
163
164# Internal functions

Callers 1

visit_lambda_exprMethod · 0.90

Calls 8

get_proper_typeFunction · 0.90
RuntimeArgClass · 0.90
FuncSignatureClass · 0.90
isinstanceFunction · 0.85
zipFunction · 0.85
gen_func_itemFunction · 0.85
appendMethod · 0.80
type_to_rtypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…