Given a FuncDef, return the target for the instance of its callable class. If the function was not already defined somewhere, then define it and add it to the current environment.
(builder: IRBuilder, fdef: FuncDef)
| 900 | |
| 901 | |
| 902 | def get_func_target(builder: IRBuilder, fdef: FuncDef) -> AssignmentTarget: |
| 903 | """Given a FuncDef, return the target for the instance of its callable class. |
| 904 | |
| 905 | If the function was not already defined somewhere, then define it |
| 906 | and add it to the current environment. |
| 907 | """ |
| 908 | if orig := fdef.original_def: |
| 909 | if isinstance(orig, Decorator): |
| 910 | orig = orig.func |
| 911 | # Get the target associated with the previously defined FuncDef. |
| 912 | return builder.lookup(orig) |
| 913 | |
| 914 | if builder.fn_info.is_generator or builder.fn_info.add_nested_funcs_to_env: |
| 915 | return builder.lookup(fdef) |
| 916 | |
| 917 | return builder.add_local_reg(fdef, object_rprimitive) |
| 918 | |
| 919 | |
| 920 | def load_type(builder: IRBuilder, typ: TypeInfo, unbounded_type: Type | None, line: int) -> Value: |
no test coverage detected
searching dependent graphs…