Skip to main content

SymbolTable

Struct SymbolTable 

Source
pub struct SymbolTable { /* private fields */ }

Implementations§

Source§

impl SymbolTable

Source

pub fn register_builtins(&mut self)

Source§

impl SymbolTable

Source

pub fn load_nomiscript_defuns(&mut self, source: &str, label: &str)

Parses a DEFUN-only nomiscript source and registers each defun into this table via the eval special-form path (the same mechanism load_financial_structs uses for DEFSTRUCT). Shared by the universal prelude here and the rpc host prelude. A parse or non-DEFUN form is a first-party authoring bug: it is logged and (in debug) asserts, rather than silently shipping a broken prelude.

Source§

impl SymbolTable

Source

pub fn new() -> Self

Source

pub fn record_closure_result(&mut self, sig: ClosureSigId, result: WasmType)

Records the result WasmType for a closure signature id (see Self::closure_results). Called by the closure-emit sites, which hold the CompileContext and so know the sig’s true result type.

Source

pub fn closure_result(&self, sig: ClosureSigId) -> Option<WasmType>

The recorded result WasmType for a closure signature id, or None if the closure wasn’t emitted through a recording site (e.g. a closure reaching the eval surface from a path that doesn’t record).

Source

pub fn with_builtins() -> Self

Source

pub fn with_builtins_for_wasm() -> Self

Source

pub fn define(&mut self, symbol: Symbol)

Source

pub fn register_test(&mut self, name: impl Into<String>, body: Expr)

Register a named test (DEFTEST); RUN-TESTS reads it via [tests]. Re-registering an existing name overwrites its body in place (matching [define]’s overwrite semantics) rather than appending, so the two-surface compile — which may evaluate a DEFTEST on both the eval and codegen passes — stays idempotent and never double-runs a test.

Source

pub fn tests(&self) -> Vec<(String, Expr)>

Snapshot of registered tests in declaration order. Cloned so RUN-TESTS can iterate without holding a borrow on the table it needs to evaluate against.

Source

pub fn mark_native_referenced(&mut self, name: &str)

Records a compile-time reference to native fn name. Called from the compiler’s host_fn::compile_host_fn_for_* whenever a wasm import call is emitted for name.

Source

pub fn native_coverage(&self) -> &HashMap<String, u32>

Compile-time reference counts per native fn name. The map only contains names that were emitted at least once; callers that need a complete-vs-missing report should cross-reference against the registered HostFnSpec list.

Source

pub fn register_host_fns(&mut self, host_fns: &[HostFnSpec])

Pre-registers the lisp-side symbol for each host fn so the compiler’s resolve_arg + native-dispatch path picks them up. The symbol’s value slot carries a WasmRuntime(result-type) stand-in so callers that eval the host-fn form during compile-time analysis (CONS element inference, arithmetic dispatch type lookup, etc.) see the right result type without needing to actually run the host fn. The matching wasm import is registered separately by CompileContext::new_eval_with_host_fns.

Source

pub fn lookup(&self, name: &str) -> Option<&Symbol>

Source

pub fn lookup_qualified( &self, namespace: Option<&str>, name: &str, ) -> Option<&Symbol>

Looks up a (possibly namespaced) name via its canonical key (ADR-0029). Resolution is strict and lexical: a qualified (Some(ns), name) looks up only NS:NAME, an unqualified (None, name) looks up only NAME — there is no cross-namespace fallback and no ambient “current namespace”. Most call sites pass the already-canonical Expr::Symbol string straight to Self::lookup; this helper is for callers that hold the split parts.

Source

pub fn lookup_mut(&mut self, name: &str) -> Option<&mut Symbol>

Source

pub fn remove(&mut self, name: &str) -> Option<Symbol>

Source

pub fn contains(&self, name: &str) -> bool

Source

pub fn iter(&self) -> impl Iterator<Item = (&String, &Symbol)>

Source

pub fn define_struct_fields( &mut self, name: impl Into<String>, fields: Vec<String>, )

Source

pub fn struct_fields(&self, name: &str) -> Option<&[String]>

Trait Implementations§

Source§

impl Clone for SymbolTable

Source§

fn clone(&self) -> SymbolTable

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SymbolTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SymbolTable

Source§

fn default() -> SymbolTable

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,