mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
C#: Add tests for qualified delegate calls
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
| delegates.cs:72:13:72:20 | delegate call | delegates.cs:72:13:72:15 | access to local variable cd1 |
|
||||
| delegates.cs:74:13:74:23 | delegate call | delegates.cs:74:13:74:15 | access to local variable cd7 |
|
||||
| delegates.cs:79:22:79:26 | delegate call | delegates.cs:79:22:79:23 | access to local variable pi |
|
||||
| delegates.cs:79:30:79:35 | delegate call | delegates.cs:79:30:79:31 | access to local variable ps |
|
||||
| delegates.cs:93:13:93:25 | delegate call | delegates.cs:93:13:93:16 | this access |
|
||||
| delegates.cs:94:13:94:28 | delegate call | delegates.cs:94:13:94:16 | this access |
|
||||
| delegates.cs:95:13:95:20 | delegate call | delegates.cs:95:13:95:17 | access to field Field |
|
||||
| delegates.cs:96:13:96:23 | delegate call | delegates.cs:96:13:96:20 | access to property Property |
|
||||
4
csharp/ql/test/library-tests/delegates/Delegates4.ql
Normal file
4
csharp/ql/test/library-tests/delegates/Delegates4.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import csharp
|
||||
|
||||
from DelegateCall dc
|
||||
select dc, dc.getExpr()
|
||||
@@ -249,3 +249,33 @@ delegates.cs:
|
||||
# 81| 16: [LocalVariableDeclStmt] ... ...;
|
||||
# 81| 0: [LocalVariableDeclExpr] ContextCallback d
|
||||
# 81| 0: [TypeMention] ContextCallback
|
||||
# 86| 10: [Class] E
|
||||
# 88| 5: [Field] Field
|
||||
# 88| -1: [TypeMention] Action<int>
|
||||
# 88| 1: [TypeMention] int
|
||||
# 89| 6: [Property] Property
|
||||
# 89| -1: [TypeMention] Action<int>
|
||||
# 89| 1: [TypeMention] int
|
||||
# 89| 3: [Getter] get_Property
|
||||
# 89| 4: [Setter] set_Property
|
||||
#-----| 2: (Parameters)
|
||||
# 89| 0: [Parameter] value
|
||||
# 91| 7: [Method] M
|
||||
# 91| -1: [TypeMention] Void
|
||||
# 92| 4: [BlockStmt] {...}
|
||||
# 93| 0: [ExprStmt] ...;
|
||||
# 93| 0: [DelegateCall] delegate call
|
||||
# 93| -1: [ThisAccess] this access
|
||||
# 93| 0: [IntLiteral] 0
|
||||
# 94| 1: [ExprStmt] ...;
|
||||
# 94| 0: [DelegateCall] delegate call
|
||||
# 94| -1: [ThisAccess] this access
|
||||
# 94| 0: [IntLiteral] 0
|
||||
# 95| 2: [ExprStmt] ...;
|
||||
# 95| 0: [DelegateCall] delegate call
|
||||
# 95| -1: [FieldAccess] access to field Field
|
||||
# 95| 0: [IntLiteral] 0
|
||||
# 96| 3: [ExprStmt] ...;
|
||||
# 96| 0: [DelegateCall] delegate call
|
||||
# 96| -1: [PropertyCall] access to property Property
|
||||
# 96| 0: [IntLiteral] 0
|
||||
|
||||
@@ -83,4 +83,17 @@ namespace Delegates
|
||||
|
||||
}
|
||||
|
||||
class E
|
||||
{
|
||||
Action<int> Field;
|
||||
Action<int> Property { get; set; }
|
||||
|
||||
void M()
|
||||
{
|
||||
this.Field(0);
|
||||
this.Property(0);
|
||||
Field(0);
|
||||
Property(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user