pub struct EmitCtx {
pub local_types: HashMap<String, Type>,
pub rc_wrapped: HashSet<String>,
pub borrowed_params: HashSet<String>,
pub current_module_scope: Option<String>,
}Expand description
Emission context carrying Rust-specific type/borrow policy.
Fields§
§local_types: HashMap<String, Type>Local variable types (from fn params) for copy-type elision.
rc_wrapped: HashSet<String>Parameters passed as Rc<T> (self-TCO) or &T (mutual-TCO pass-through).
borrowed_params: HashSet<String>Parameters emitted as &T borrows (borrow-by-default for non-Copy, non-Str params).
current_module_scope: Option<String>Owning module prefix for the function whose body this context
is emitting (Some("Domain.Eval.Core") inside a dep module’s
fn body, None for entry-scope fns). Threaded into
ctx.resolve_expr / ctx.resolve_stmt / ctx.resolve_pattern
from the on-demand legacy emit helpers so cross-module ctor /
fn classification uses the right resolver current_module
instead of falling back to the entry’s. Pre-PR-9.4 the legacy
helpers used the entry-module name uniformly, which silently
mis-resolved cross-module Type.Variant(...) calls inside
trampoline arms (self-host regen exposure).
Implementations§
Source§impl EmitCtx
impl EmitCtx
Sourcepub fn for_fn(param_types: HashMap<String, Type>) -> Self
pub fn for_fn(param_types: HashMap<String, Type>) -> Self
Build context for a function with known parameter types.
Automatically computes borrowed_params from param types.
Sourcepub fn for_fn_no_borrow(param_types: HashMap<String, Type>) -> Self
pub fn for_fn_no_borrow(param_types: HashMap<String, Type>) -> Self
Build context for a function WITHOUT borrow-by-default (e.g. TCO).
Sourcepub fn with_scope(self, scope: Option<&str>) -> Self
pub fn with_scope(self, scope: Option<&str>) -> Self
Stamp the owning module prefix onto a context — chains
fluently after for_fn / for_fn_no_borrow. None for
entry-scope fns keeps the field default.
Sourcepub fn is_copy(&self, name: &str) -> bool
pub fn is_copy(&self, name: &str) -> bool
Is this variable a Copy type in Rust (i64, f64, bool, ())?
Sourcepub fn is_rc_wrapped(&self, name: &str) -> bool
pub fn is_rc_wrapped(&self, name: &str) -> bool
Is this variable a pass-through parameter (Rc
Sourcepub fn is_borrowed_param(&self, name: &str) -> bool
pub fn is_borrowed_param(&self, name: &str) -> bool
Is this variable a borrowed parameter (&T from borrow-by-default)?
Sourcepub fn with_rc_wrapped(&self, rc: HashSet<String>) -> Self
pub fn with_rc_wrapped(&self, rc: HashSet<String>) -> Self
Create a context with specified Rc-wrapped parameters (TCO pass-through).