Generate glue methods that mediate between different method types in subclasses. Works on both properties and methods. See gen_glue_methods below for more details. If do_py_ops is True, then the glue methods should use generic C API operations instead of direct calls, to enable gen
(
builder: IRBuilder,
base_sig: FuncSignature,
target: FuncIR,
cls: ClassIR,
base: ClassIR,
fdef: FuncItem,
*,
do_py_ops: bool = False,
)
| 635 | |
| 636 | |
| 637 | def gen_glue( |
| 638 | builder: IRBuilder, |
| 639 | base_sig: FuncSignature, |
| 640 | target: FuncIR, |
| 641 | cls: ClassIR, |
| 642 | base: ClassIR, |
| 643 | fdef: FuncItem, |
| 644 | *, |
| 645 | do_py_ops: bool = False, |
| 646 | ) -> FuncIR: |
| 647 | """Generate glue methods that mediate between different method types in subclasses. |
| 648 | |
| 649 | Works on both properties and methods. See gen_glue_methods below |
| 650 | for more details. |
| 651 | |
| 652 | If do_py_ops is True, then the glue methods should use generic |
| 653 | C API operations instead of direct calls, to enable generating |
| 654 | "shadow" glue methods that work with interpreted subclasses. |
| 655 | """ |
| 656 | if fdef.is_property: |
| 657 | return gen_glue_property(builder, base_sig, target, cls, base, fdef.line, do_py_ops) |
| 658 | if do_py_ops and target.name.startswith(PROPSET_PREFIX): |
| 659 | return gen_glue_property_setter(builder, base_sig, target, cls, base, fdef.line) |
| 660 | return gen_glue_method(builder, base_sig, target, cls, base, fdef.line, do_py_ops) |
| 661 | |
| 662 | |
| 663 | class ArgInfo(NamedTuple): |
no test coverage detected
searching dependent graphs…