Skip to content

Commit 4e63b83

Browse files
committed
C#: Add struct source model example.
1 parent ea1fc43 commit 4e63b83

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

csharp/ql/test/library-tests/dataflow/external-models/Sources.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ void Foo()
2121

2222
x = TaggedSrcPropertyGetter;
2323
x = this[0];
24+
25+
S s;
26+
StructSrc(s);
2427
}
2528

2629
[SourceAttribute]
@@ -65,7 +68,10 @@ void SrcArg(object src) { }
6568

6669
[SourceAttribute]
6770
object this[int i] => null;
71+
72+
void StructSrc(S s) { }
6873
}
6974

75+
struct S { }
7076
class SourceAttribute : System.Attribute { }
7177
}

csharp/ql/test/library-tests/dataflow/external-models/srcs.expected

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ invalidModelRow
1111
| Sources.cs:20:17:20:33 | call to method SrcTwoArg | local |
1212
| Sources.cs:22:17:22:39 | access to property TaggedSrcPropertyGetter | local |
1313
| Sources.cs:23:17:23:23 | access to indexer | local |
14-
| Sources.cs:27:14:27:20 | this | local |
15-
| Sources.cs:27:29:27:45 | taggedMethodParam | local |
16-
| Sources.cs:31:47:31:60 | taggedSrcParam | local |
17-
| Sources.cs:43:45:43:45 | p | local |
18-
| Sources.cs:50:50:50:50 | p | local |
19-
| Sources.cs:56:16:56:30 | this | local |
14+
| Sources.cs:30:14:30:20 | this | local |
15+
| Sources.cs:30:29:30:45 | taggedMethodParam | local |
16+
| Sources.cs:34:47:34:60 | taggedSrcParam | local |
17+
| Sources.cs:46:45:46:45 | p | local |
18+
| Sources.cs:53:50:53:50 | p | local |
19+
| Sources.cs:59:16:59:30 | this | local |

csharp/ql/test/library-tests/dataflow/external-models/srcs.ext.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ extensions:
1919
- ["My.Qltest", "SourceAttribute", false, "", "", "Attribute", "", "local", "manual"]
2020
- ["My.Qltest", "SourceAttribute", false, "", "", "Attribute.Getter", "ReturnValue", "local", "manual"]
2121
- ["My.Qltest", "A", false, "SrcTwoArg", "(System.String,System.String)", "", "ReturnValue", "local", "manual"]
22+
- ["My.Qltest", "A", false, "StructSrc", "", "", "Argument[0]", "local", "manual"]

0 commit comments

Comments
 (0)