this ensures libp2p continues to compile [backport] (#18908)

This commit is contained in:
Andreas Rumpf 2021-09-27 19:25:00 +02:00 • committed by GitHub
commit cdf9ac675b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View file

@ -441,8 +441,14 @@ proc sameTree*(a, b: PNode): bool =
proc hasSubTree(n, x: PNode): bool =
if n.sameTree(x): result = true
else:
for i in 0..n.safeLen-1:
if hasSubTree(n[i], x): return true
case n.kind
of nkEmpty..nkNilLit:
result = n.sameTree(x)
of nkFormalParams:
discard
else:
for i in 0..<n.len:
if hasSubTree(n[i], x): return true
proc invalidateFacts*(s: var seq[PNode], n: PNode) =
# We are able to guard local vars (as opposed to 'let' variables)!