mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
C#: Extractor tests for
- While statements - Object initializers
This commit is contained in:
@@ -81,3 +81,28 @@ class Designations
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
class WhileIs
|
||||
{
|
||||
void Test()
|
||||
{
|
||||
object x = null;
|
||||
while(x is string s)
|
||||
{
|
||||
var y = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ObjectInitializerType
|
||||
{
|
||||
struct Point
|
||||
{
|
||||
public object Name;
|
||||
}
|
||||
|
||||
void F()
|
||||
{
|
||||
new Point() { Name = "Bob" };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,3 +39,10 @@
|
||||
| Program.cs:69:5:69:8 | Boolean |
|
||||
| Program.cs:69:16:69:18 | Int32 |
|
||||
| Program.cs:75:5:75:7 | Int32 |
|
||||
| Program.cs:87:5:87:8 | Void |
|
||||
| Program.cs:89:9:89:14 | Object |
|
||||
| Program.cs:90:20:90:25 | String |
|
||||
| Program.cs:92:13:92:15 | String |
|
||||
| Program.cs:101:16:101:21 | Object |
|
||||
| Program.cs:104:5:104:8 | Void |
|
||||
| Program.cs:106:13:106:17 | Point |
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| Program.cs:92:21:92:21 | access to local variable s |
|
||||
5
csharp/ql/test/library-tests/regressions/WhileIs.ql
Normal file
5
csharp/ql/test/library-tests/regressions/WhileIs.ql
Normal file
@@ -0,0 +1,5 @@
|
||||
import csharp
|
||||
|
||||
from LocalVariable decl
|
||||
where decl.getName() = "s"
|
||||
select decl.getAnAccess()
|
||||
Reference in New Issue
Block a user