Ruby: CFG: make Completion.isValidFor work for getSugared AST nodes

This commit is contained in:
Arthur Baars
2021-12-07 16:51:24 +01:00
parent 660e52f2bf
commit 3689481c18

View File

@@ -84,6 +84,8 @@ private predicate mayRaise(Call c) {
abstract class Completion extends TCompletion {
/** Holds if this completion is valid for node `n`. */
predicate isValidFor(AstNode n) {
exists(AstNode other | n = other.getDesugared() and this.isValidFor(other))
or
this = n.(NonReturningCall).getACompletion()
or
completionIsValidForStmt(n, this)
@@ -229,8 +231,6 @@ private predicate inMatchingContext(AstNode n) {
or
n = any(VariableReferencePattern p).getVariableAccess()
or
n = any(CasePattern c).getDesugared()
or
n.(Trees::DefaultValueParameterTree).hasDefaultValue()
}