Skip to main content

Module method_context

Module method_context 

Source
Expand description

Shared per-method context for trait-impl R wrapper generation.

Parallels r_class_formatter::MethodContext (used by the 6 inherent-impl class generators) so the 5 trait generators (env/s3/s4/s7/r6) build .Call() invocations and method preludes the same way instead of each hand-rolling its own version. See audit/2026-07-03-dogfooding-macros-codegen.md finding #1: the trait path previously shared nothing above DotCallBuilder, which caused a substring-corruption bug in the receiver-ptr extraction (S4/S7/R6) and a silent 3-of-6-step prelude omission (missing precondition_checks / match_arg_prelude) relative to inherent methods.

Structsยง

TraitMethodContext ๐Ÿ”’
Pre-computed context for a trait method, mirroring MethodContext (r_class_formatter.rs) for inherent-impl methods. Holds the C wrapper name, R formals (with defaults), and .Call() argument string so all 5 trait generators build calls identically.