lang: unification: Move the InvariantSolution struct
We are just relocating this in the file for consistency.
This commit is contained in:
@@ -143,6 +143,22 @@ func (obj *Unifier) Unify() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InvariantSolution lists a trivial set of EqualsInvariant mappings so that you
|
||||||
|
// can populate your AST with SetType calls in a simple loop.
|
||||||
|
type InvariantSolution struct {
|
||||||
|
Solutions []*interfaces.EqualsInvariant // list of trivial solutions for each node
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExprList returns the list of valid expressions. This struct is not part of
|
||||||
|
// the invariant interface, but it implements this anyways.
|
||||||
|
func (obj *InvariantSolution) ExprList() []interfaces.Expr {
|
||||||
|
exprs := []interfaces.Expr{}
|
||||||
|
for _, x := range obj.Solutions {
|
||||||
|
exprs = append(exprs, x.ExprList()...)
|
||||||
|
}
|
||||||
|
return exprs
|
||||||
|
}
|
||||||
|
|
||||||
// exclusivesProduct returns a list of different products produced from the
|
// exclusivesProduct returns a list of different products produced from the
|
||||||
// combinatorial product of the list of exclusives. Each ExclusiveInvariant must
|
// combinatorial product of the list of exclusives. Each ExclusiveInvariant must
|
||||||
// contain between one and more Invariants. This takes every combination of
|
// contain between one and more Invariants. This takes every combination of
|
||||||
@@ -181,19 +197,3 @@ func exclusivesProduct(exclusives []*interfaces.ExclusiveInvariant) [][]interfac
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
// InvariantSolution lists a trivial set of EqualsInvariant mappings so that you
|
|
||||||
// can populate your AST with SetType calls in a simple loop.
|
|
||||||
type InvariantSolution struct {
|
|
||||||
Solutions []*interfaces.EqualsInvariant // list of trivial solutions for each node
|
|
||||||
}
|
|
||||||
|
|
||||||
// ExprList returns the list of valid expressions. This struct is not part of
|
|
||||||
// the invariant interface, but it implements this anyways.
|
|
||||||
func (obj *InvariantSolution) ExprList() []interfaces.Expr {
|
|
||||||
exprs := []interfaces.Expr{}
|
|
||||||
for _, x := range obj.Solutions {
|
|
||||||
exprs = append(exprs, x.ExprList()...)
|
|
||||||
}
|
|
||||||
return exprs
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user