File tree Expand file tree Collapse file tree
csharp/ql/src/semmle/code/csharp/exprs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -654,6 +654,14 @@ class QualifiableExpr extends Expr, @qualifiable_expr {
654654 predicate isConditional ( ) { conditional_access ( this ) }
655655}
656656
657+ private Expr getAnAssignOrForeachChild ( ) {
658+ result = any ( AssignExpr e ) .getLValue ( )
659+ or
660+ result = any ( ForeachStmt fs ) .getVariableDeclTuple ( )
661+ or
662+ result = getAnAssignOrForeachChild ( ) .getAChildExpr ( )
663+ }
664+
657665/**
658666 * An expression representing a tuple, for example
659667 * `(1, 2)` on line 2 or `(var x, var y)` on line 5 in
@@ -678,10 +686,7 @@ class TupleExpr extends Expr, @tuple_expr {
678686 Expr getAnArgument ( ) { result = getArgument ( _) }
679687
680688 /** Holds if this tuple is a read access. */
681- predicate isReadAccess ( ) {
682- not exists ( AssignExpr e | this = e .getLValue ( ) .getAChildExpr * ( ) ) and
683- not exists ( ForeachStmt fs | this = fs .getVariableDeclTuple ( ) .getAChildExpr * ( ) )
684- }
689+ predicate isReadAccess ( ) { not this = getAnAssignOrForeachChild ( ) }
685690}
686691
687692/**
You can’t perform that action at this time.
0 commit comments