Rust: Make Element.toString non-recursive

This commit is contained in:
Tom Hvitved
2025-03-31 14:37:02 +02:00
parent 279e9e2d70
commit 4fb138a1a3
7 changed files with 31 additions and 8 deletions

View File

@@ -30,7 +30,11 @@ module Generated {
* Gets the string representation of this element.
*/
cached
final string toString() { result = this.toStringImpl() }
final string toString() {
result = this.toStringImpl() and
// recursion guard to prevent `toString` from being defined recursively
(exists(any(Element e).toStringImpl()) implies any())
}
/**
* INTERNAL: Do not use.