You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add `Submodel`, and refactor `Model` to be a wrapper over `Submodel`.
This commit is part of on-going work to add lexical scope to Conjure
Oxide and is a follow up to 8636432 (feat!: add parent symbol tables
(#680), 2025-02-17).
DETAILS
A `Submodel` represents a particular scope and holds the symbol-table
and constraints tree for that scope.
This commit refactors `Model` to be a wrapper over `Submodel`, and
removes methods operating on constraints and the symbol table from
`Model`, placing them in `Submodel` instead. A `Model` can be borrowed as
a `Submodel` using `as_submodel()` and `as_submodel_mut()`.
The language semantics of a top level model and a sub-model are
identical, so treating it as `Submodel` in most cases is valid.
`Model` is a separate type than `Submodel` for the following reasons:
+ It will hold global-only information in the future, such as dominance
constraints.
+ It holds a pointer to the context.
+ We need special initialisation and de-serialisation logic for the
top level model that we do not want for `Submodel`. See
`SerdeModel`.
0 commit comments