mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
Implement dataflow for record patterns
Strategy: there is now a regular flow step from an instance-of LHS / switch expr to the pattern, 0 or more read steps corresponding to record pattern destructors, and then finally a normal SSA def/use step connecting the binding patterns to their first uses.
This commit is contained in:
@@ -1639,7 +1639,11 @@ class LocalVariableDeclExpr extends Expr, @localvariabledeclexpr {
|
||||
/** Gets the name of the variable declared by this local variable declaration expression. */
|
||||
string getName() { result = this.getVariable().getName() }
|
||||
|
||||
/** Gets the switch statement or expression whose pattern declares this identifier, if any. */
|
||||
/**
|
||||
* Gets the switch statement or expression whose pattern declares this identifier, if any.
|
||||
*
|
||||
* Note this only applies to a direct binding pattern, such as `case T t`, not a record pattern.
|
||||
*/
|
||||
StmtParent getAssociatedSwitch() { result = this.getParent().(PatternCase).getParent() }
|
||||
|
||||
/** Holds if this is a declaration stemming from a pattern switch case. */
|
||||
|
||||
Reference in New Issue
Block a user