Skip to content

getAChild*() not returning all children #7175

Answered by hvitved
gsingh93 asked this question in Q&A
Discussion options

You must be logged in to vote

The problem here is that Expr::getAChild and Stmt::getAChild are actually two different predicates. So when you take the transitive closure of Stmt::getAChild, then it will not include Expr::getAChild.

What you can do is write your own getAChild predicate

StmtParent getAChild(StmtParent p) {
  result = p.(Expr).getAChild()
  or
  result = p.(Stmt).getAChild()
}

and then take the transitive reflexive closure of that.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@hvitved
Comment options

@gsingh93
Comment options

@hvitved
Comment options

@MathiasVP
Comment options

@gsingh93
Comment options

Answer selected by gsingh93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants