CFG: hide nodes that are not proper AstNodes

This commit is contained in:
Arthur Baars
2021-02-18 18:13:00 +01:00
parent 14474d660b
commit cb21e8edda
4 changed files with 169 additions and 703 deletions

View File

@@ -14,26 +14,4 @@ module AstNode {
predicate child(string label, AstNode::Range child) { none() }
}
// TODO: Remove
private class RemoveWhenFullCoverage extends Range {
// Lists the entities that are currently used in tests but do not yet
// have an external ASTNode. Perhaps not all entities below need to be
// an AST node, for example we include the `in` keyword in `for` loops
// in the CFG, but not the AST
RemoveWhenFullCoverage() {
this = any(Generated::Method m).getName()
or
this = any(Generated::SingletonMethod m).getName()
or
this = any(Generated::Call c).getMethod() and
not this instanceof Generated::ScopeResolution
or
this instanceof Generated::RestAssignment
or
this instanceof Generated::Superclass
}
override string toString() { result = "AstNode" }
}
}

View File

@@ -203,7 +203,20 @@ private predicate succImpl(AstNode pred, AstNode succ, Completion c) {
any(ControlFlowTree cft).succ(pred, succ, c)
}
private predicate isHidden(ControlFlowTree t) { t.isHidden() }
private predicate isHidden(ControlFlowTree t) {
t.isHidden()
or
t = any(Method m).getName()
or
t = any(SingletonMethod m).getName()
or
t = any(Call c).getMethod() and
not t instanceof ScopeResolution
or
t instanceof RestAssignment
or
t instanceof Superclass
}
private predicate succImplIfHidden(AstNode pred, AstNode succ) {
isHidden(pred) and