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.

Functions§

trait_namespace_env_var 🔒
The local environment variable S7 trait wrappers assign members into before attaching it to the class object via attr(). One owner so trait_namespace_target’s S7 arm and the generator’s new.env / attr() lines can’t drift apart.
trait_namespace_target 🔒
R-visible assignment target for a trait member (method or const) placed in the per-class trait namespace — the single owner of the namespace-shape policy the 5 generators previously hand-rolled independently (audit 2026-07-03-dogfooding-macros-codegen.md finding #1; #1141). member is the R-facing method/const name.