Fix T92328: crash during field inferencing when there is a link cycle

The toposort did not handle link cycles which it should.
This commit is contained in:
2021-10-27 12:29:46 +02:00
parent d161b5d204
commit c06a86f99f
3 changed files with 101 additions and 54 deletions

View File

@@ -287,7 +287,17 @@ class NodeTreeRef : NonCopyable, NonMovable {
RightToLeft,
};
Vector<const NodeRef *> toposort(ToposortDirection direction) const;
struct ToposortResult {
Vector<const NodeRef *> sorted_nodes;
/**
* There can't be a correct topologycal sort of the nodes when there is a cycle. The nodes will
* still be sorted to some degree. The caller has to decide whether it can handle non-perfect
* sorts or not.
*/
bool has_cycle = false;
};
ToposortResult toposort(ToposortDirection direction) const;
bNodeTree *btree() const;
StringRefNull name() const;