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
impl UnfrozenIR
Sourcepub fn freeze(
self,
registry: Registry,
owner: &DagId,
resolver: &ModuleResolver,
src: &NamedSource<Arc<String>>,
) -> Result<IR, GraphcalError>
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.
Sourcepub fn override_param_default(&mut self, name: &str, expr: Expr) -> bool
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.
Sourcepub fn add_const_alias(
&mut self,
name: ScopedName,
type_ann: TypeExpr,
expr: Expr,
span: Span,
)
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.
Sourcepub fn add_node_alias(
&mut self,
name: ScopedName,
type_ann: TypeExpr,
expr: Expr,
span: Span,
)
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.
Sourcepub 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>
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.
Sourcepub 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>
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.