lang: ast: Catch ordering errors
This commit is contained in:
@@ -5017,7 +5017,6 @@ func (obj *StmtProg) SetScope(scope *interfaces.Scope) error {
|
|||||||
// If we don't do this deterministically the type unification errors can
|
// If we don't do this deterministically the type unification errors can
|
||||||
// flip from `type error: int != str` to `type error: str != int` etc...
|
// flip from `type error: int != str` to `type error: str != int` etc...
|
||||||
nodeOrder, err := orderingGraph.DeterministicTopologicalSort() // sorted!
|
nodeOrder, err := orderingGraph.DeterministicTopologicalSort() // sorted!
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: print the cycle in a prettier way (with names?)
|
// TODO: print the cycle in a prettier way (with names?)
|
||||||
if obj.data.Debug {
|
if obj.data.Debug {
|
||||||
@@ -5026,6 +5025,12 @@ func (obj *StmtProg) SetScope(scope *interfaces.Scope) error {
|
|||||||
}
|
}
|
||||||
return errwrap.Wrapf(err, "recursive reference while setting scope")
|
return errwrap.Wrapf(err, "recursive reference while setting scope")
|
||||||
}
|
}
|
||||||
|
if obj.data.Debug { // XXX: catch ordering errors in the logs
|
||||||
|
obj.data.Logf("nodeOrder:")
|
||||||
|
for i, x := range nodeOrder {
|
||||||
|
obj.data.Logf("nodeOrder[%d]: %+v", i, x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: implement ValidTopoSortOrder!
|
// XXX: implement ValidTopoSortOrder!
|
||||||
//topoSanity := (RequireTopologicalOrdering || TopologicalOrderingWarning)
|
//topoSanity := (RequireTopologicalOrdering || TopologicalOrderingWarning)
|
||||||
|
|||||||
Reference in New Issue
Block a user