Skip to content

Commit d54406d

Browse files
committed
C#: Add switch example.
1 parent 65b32b6 commit d54406d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

csharp/ql/test/library-tests/dataflow/global/GlobalDataFlow.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,22 @@ public void M8(SimpleClass x)
530530
Check(x.field);
531531
Check(y.field);
532532
}
533+
534+
public void M9(string choice)
535+
{
536+
var x = new SimpleClass();
537+
var y = new SimpleClass();
538+
var z = new SimpleClass();
539+
TaintField(choice switch
540+
{
541+
"x" => x,
542+
"y" => y,
543+
_ => z
544+
});
545+
Check(x.field);
546+
Check(y.field);
547+
Check(z.field);
548+
}
533549
}
534550

535551
static class IEnumerableExtensions

0 commit comments

Comments
 (0)