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§
- Trait
Method 🔒Context - 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§
- s7_
trait_ 🔒member_ access - How R code reaches an S7 trait static or const:
attr(Type, "Trait")$member, also the topic alias of its documentation block. The trait namespace is an attribute of the class object, andType$Trait$memberdoes not reach it: an S7 class object is a function, and S7’s$method stops on any S7 object that is not a list or an environment (“Can’t get S7 properties with$”). - 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 sotrait_namespace_target’s S7 arm and the generator’snew.env/attr()lines can’t drift apart. - trait_
namespace_ 🔒symbol trait_namespace_targetin R code position (the left of<-, the argument ofattr()). A non-syntactic member (an operatorr_name, #1475) is backtick-quoted:Type$Trait$[[, orType_Trait_[[`` for S4. Roxygen@namekeeps the baretrait_namespace_targetspelling.- 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.mdfinding #1; #1141).memberis the R-facing method/const name.