Skip to main content

UnfrozenIR

Struct UnfrozenIR 

Source
pub struct UnfrozenIR {
    pub included_plots: Vec<IncludedPlotEntry>,
    pub source_order: Vec<(ScopedName, DeclCategory)>,
    /* private fields */
}
Expand description

An IR without a frozen registry, awaiting a call to freeze.

Fields§

§included_plots: Vec<IncludedPlotEntry>

Plot aliases from include brace lists (#847).

§source_order: Vec<(ScopedName, DeclCategory)>

All declaration names in source order with their category.

Implementations§

Source§

impl UnfrozenIR

Source

pub fn freeze( self, registry: Registry, owner: &DagId, resolver: &ModuleResolver, src: &NamedSource<Arc<String>>, ) -> Result<IR, GraphcalError>

Freeze into a complete IR by providing a built Registry and the resolution context.

This is the lowering boundary of the pipeline: every declaration body assembled so far (including merged include instances and applied overrides) is lowered to HIR here, so the frozen IR carries no syntax-AST expression.

§Errors

Returns a GraphcalError if any body contains a reference that cannot be resolved.

Source

pub fn override_param_default(&mut self, name: &str, expr: Expr) -> bool

Replace a param’s default expression with an override.

Returns false when no param entry with that leaf name exists.

Source

pub fn add_const_alias( &mut self, name: ScopedName, type_ann: TypeExpr, expr: Expr, span: Span, )

Add a const alias: a synthetic const declaration that references another const.

Used for selective instantiated imports where delta_v aliases prefix.delta_v.

Source

pub fn add_node_alias( &mut self, name: ScopedName, type_ann: TypeExpr, expr: Expr, span: Span, )

Add a node alias: a synthetic node declaration that references another node/param.

Used for selective instantiated imports where delta_v aliases prefix.delta_v.

Source

pub fn check_include_reconciles_overrides( &self, bindings: &HashMap<DeclName, Expr>, index_bindings: &HashMap<IndexName, IndexName>, type_bindings: &HashMap<StructTypeName, StructTypeName>, importer_src: &NamedSource<Arc<String>>, include_span: Span, ) -> Result<(), GraphcalError>

Scan param defaults for variant literals of overridden pub(bind) indexes (and nominally-tied names of overridden types) whose owning param is not itself re-bound — axiom A8 / diagnostic V005.

Per axiom §1, only index and type overrides have nominal substructure; dim and param overrides substitute totally and never trigger A8.

Other non-bindable declaration kinds (node, const) are guarded at library compile time by V004 (A10c), so their bodies cannot mention overridden-symbol nominals once a library is accepted. Sink-kind declarations (assert, plot, figure, layer) pick up the A10(b) private-only carve-out; this check stays focused on param for that reason.

Source

pub fn merge_dependency( &mut self, dep: Self, prefix: &str, bindings: &HashMap<DeclName, Expr>, dep_names: &HashSet<DeclName>, index_bindings: &HashMap<IndexName, IndexName>, type_bindings: &HashMap<StructTypeName, StructTypeName>, dim_bindings: &HashMap<DimName, DimName>, import_item_attributes: &HashMap<DeclName, Vec<Attribute>>, requested_plots: &HashMap<DeclName, RequestedPlot>, importer_src: &NamedSource<Arc<String>>, dep_src: &NamedSource<Arc<String>>, ) -> Result<(), GraphcalError>

Merge an instantiated dependency’s IR into this IR.

All declarations from the dependency are prefixed with prefix. and appended to this IR’s declaration lists. Param bindings replace the dependency’s param default expressions. Internal references within the dependency’s expressions are rewritten to use prefixed names.

dep_names is the set of all declaration names in the dependency (before prefixing), used to determine which references should be rewritten.

dep_src is the dependency body’s NamedSource: merged declarations keep the dependency file’s byte offsets, so each is tagged with it (via BodySource::or_dependency) for diagnostics raised at the importer’s freeze/TIR boundary (#868). For inline-DAG includes the body shares the importer’s source, so dep_src equals importer_src there.

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.