Skip to main content

StaticChunk

Struct StaticChunk 

Source
pub struct StaticChunk { /* private fields */ }
Expand description

One compile, flat and immutable: see the module documentation.

Implementations§

Source§

impl StaticChunk

Source

pub fn name(&self) -> &Text

The chunk’s name.

Source

pub fn top(&self) -> ModId

The top module, the chunk’s first.

Source

pub fn node(&self, id: NodeId) -> Node

Source

pub fn pat(&self, id: PatId) -> Pat

Source

pub fn lambda(&self, id: LambdaId) -> &Lambda

Source

pub fn module(&self, id: ModId) -> &Module

Source

pub fn members(&self, module: &Module) -> &[Member]

A module’s member index space (see Module::members).

Source

pub fn frame_names(&self, module: &Module) -> &[Sym]

A module’s frame slot names.

Source

pub fn imports(&self, module: &Module) -> &[ImportSpec]

A module’s import specs.

Source

pub fn captures(&self, plan: IdRange<CaptureId>) -> &[Capture]

A lambda’s frame plan.

Source

pub fn int(&self, id: IntId) -> &BigInt

Source

pub fn str(&self, id: StrId) -> &Text

Source

pub fn nodes(&self, run: Run, first: NodeId, len: u32) -> &[Node]

The len nodes of a run of kind run, starting at first.

Source

pub fn pats(&self, run: Run, first: PatId, len: u32) -> &[Pat]

The len patterns of a run of kind run, starting at first.

Source

pub fn module_ids(&self) -> impl Iterator<Item = ModId> + Clone

The ids of the chunk’s modules, the top module first.

Source

pub fn member(&self, m: ModId, index: u32) -> Option<Member>

The item or local at index of module m’s member space, or None past them, where the iotas are.

Source

pub fn member_len(&self, m: ModId) -> u32

How many items and locals module m has: the size of its id block, and where its iotas start.

Source

pub fn iota(&self, m: ModId, index: u32) -> Option<Sym>

The name of iota index of module m, counted from its first iota.

Source

pub fn index_of(&self, m: ModId, name: Sym) -> Option<u32>

The index of module m’s item name, searched by Sym. Locals are not searched: they are private.

Source

pub fn item_names(&self, m: ModId) -> impl Iterator<Item = Sym> + '_

Module m’s item names, sorted by Sym: its public listing.

Source

pub fn local_names(&self, m: ModId) -> impl Iterator<Item = Sym> + '_

Module m’s local names, sorted by Sym. Locals are unreachable as M.name from outside; this is for host introspection.

Source

pub fn iota_names(&self, m: ModId) -> impl Iterator<Item = Sym> + '_

Module m’s iota names, sorted by Sym.

Source§

impl StaticChunk

Source

pub fn to_sexp(&self, id: NodeId, ctx: &Ctx) -> String

The s-expression of node id, e.g. (app (name f) (name x)).

Source§

impl StaticChunk

Source

pub fn to_json(&self, id: NodeId, ctx: &Ctx) -> String

The tagged JSON of node id, e.g. {"app":[{"name":"f"},{"name":"x"}]}.

Source§

impl StaticChunk

Source

pub fn documents(&self) -> &[Doc]

The documents this chunk was parsed from, in order. The prelude chunk has none.

Source

pub fn node_ids(&self) -> impl Iterator<Item = NodeId>

The ids of the chunk’s nodes, in table order, debug barriers included.

Source

pub fn pat_ids(&self) -> impl Iterator<Item = PatId>

The ids of the chunk’s patterns, as node_ids.

Source

pub fn lambda_ids(&self) -> impl Iterator<Item = LambdaId>

The ids of the chunk’s lambdas, in table order.

Source

pub fn node_span(&self, id: NodeId) -> Option<ChunkSpan>

The span of node id, if it was parsed.

Source

pub fn pat_span(&self, id: PatId) -> Option<ChunkSpan>

The span of pattern id, if it was parsed.

Source

pub fn lambda_span(&self, id: LambdaId) -> Option<ChunkSpan>

The span of lambda id: its whole &, with the parameters.

Source

pub fn member_span(&self, m: ModId, index: u32) -> Option<ChunkSpan>

The span of member index of module m, counted over its items, locals and iotas: a declaration’s name = body, or an iota’s name.

Trait Implementations§

Source§

impl Debug for StaticChunk

Source§

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

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.