Commit Graph

57 Commits

Author SHA1 Message Date
Tamas Vajk
5d0c30db66 C#: Fix nullable reference type handling in type mention extraction 2020-10-20 08:23:57 +02:00
Tamas Vajk
dad5166bca C#: Print full name of type mentions in AST 2020-10-20 08:23:57 +02:00
Tamas Vajk
ca6ecb3f1e C#: Extract type mention for array creation 2020-10-20 08:23:56 +02:00
Tamas Vajk
7066568813 C#: Change type access and expression order in casts for AST printing 2020-10-20 08:23:56 +02:00
Tamas Vajk
6c48eb8c12 C#: Add type mentions to AST 2020-10-20 08:23:56 +02:00
Tamas Vajk
5fae440a58 C#: Reverse assignment child nodes in AST 2020-10-14 12:49:08 +02:00
Tamas Vajk
ee9a40e16d C#: Remove location from base types in the AST 2020-10-14 12:49:08 +02:00
Tamas Vajk
5f96c37b28 C#: Fix switch case expression types 2020-09-22 13:16:31 +02:00
Tamas Vajk
cc979d0b5f C#: Add switch case expression type test 2020-09-22 11:04:44 +02:00
Tamas Vajk
e2c205deb4 C#: Add stable order for generated accessors in printed AST 2020-09-04 10:39:01 +02:00
Tom Hvitved
51dc1515ab C#: Address review comments 2020-09-02 10:52:05 +02:00
Tom Hvitved
d17f88bbcd C#: Remove assembly prefix from all extractor IDs 2020-09-02 10:52:04 +02:00
Calum Grant
cd51a67c0d C#: Take nullability into account when creating symbol entities. Otherwise, an entity with the wrong (cached) nullability could be created. 2020-09-02 10:52:04 +02:00
Calum Grant
4657ddcb7c C#: Avoid qualifying explicit interface implementations. 2020-09-02 10:52:03 +02:00
Tom Hvitved
b8cde180b9 C#: Order top-level elements by location in PrintAst.qll 2020-08-21 06:17:37 +02:00
Tamás Vajk
2a8ff8785a C#: Add AST printing (#4038) 2020-08-20 14:24:43 +02:00
Tom Hvitved
8c0c283811 Revert "C#: Improve db consistency by removing assembly id" 2020-04-22 16:32:13 +02:00
Calum Grant
ead916702a C#: Take nullability into account when creating symbol entities. Otherwise, an entity with the wrong (cached) nullability could be created. 2020-04-20 11:29:31 +01:00
Calum Grant
abf6be6030 C#: Avoid qualifying explicit interface implementations. 2020-04-07 11:17:35 +01:00
Calum Grant
d0d7ed620c C#: Update comments in test file to reflect fixed test output. 2020-01-07 18:39:52 +00:00
Calum Grant
359dea2c2b C#: Fixed test output. 2020-01-07 18:39:52 +00:00
Calum Grant
85c9459b35 C#: Add more tests showing incorrect extraction. 2020-01-07 18:39:51 +00:00
Calum Grant
10181e93e2 C#: Update QLtest output 2020-01-07 18:39:51 +00:00
Calum Grant
8db46bc8ec C#: More tests for nullable flow state. 2020-01-07 18:38:58 +00:00
Calum Grant
6c9ebaba0b C#: Populate expression type nullability and nullable flow state. 2020-01-07 18:38:58 +00:00
Calum Grant
0327b83958 C#: Update nullability tests. 2020-01-07 18:38:58 +00:00
Calum Grant
5e6b7be5b8 C#: Update nullability tests. 2019-12-06 12:41:20 +00:00
Calum Grant
aac360463b C#: Tests for default interface methods. 2019-11-15 10:13:04 +00:00
Calum Grant
ce188c0c22 C#: Autoformat 2019-11-12 13:40:58 +00:00
Calum Grant
f00276a82c C#: Remove non-essential changes 2019-11-12 13:40:58 +00:00
Calum Grant
a0fa7dad79 C#: Autoformat 2019-11-12 13:40:58 +00:00
Calum Grant
9fd4a9ceb6 C#: Implement NullabilityEntity to model structured nullability on the side 2019-11-12 13:40:57 +00:00
Calum Grant
61ab9431ab C#: Fix DB inconsistencies, and rework id generation. 2019-11-12 13:40:57 +00:00
Tom Hvitved
5d140930d0 C#: Add field initializers to CFG for constructors
This commit adds field initializers to the CFG for non-static constructors. For
example, in

```
class C
{
    int Field1 = 0;
    int Field2 = Field1 + 1;
    int Field3;

    public C()
    {
        Field3 = 2;
    }

    public C(int i)
    {
        Field3 = 3;
    }
}
```

the initializer expressions `Field1 = 0` and `Field2 = Field1 + 1` are added
to the two constructors, mimicking

```
public C()
{
    Field1 = 0;
    Field2 = Field1 + 1;
    Field3 = 2;
}
```

and

```
public C()
{
    Field1 = 0;
    Field2 = Field1 + 1;
    Field3 = 3;
}
```

respectively. This means that we no longer have to synthesize calls, callables,
parameters, and arguments in the data flow library, so much of the work from
d1755500e4 can be simplified.
2019-08-21 16:21:38 +02:00
Tom Hvitved
d1755500e4 C#: Data flow through fields
Initial implementation of data flow through fields, using the algorithm of the
shared data flow implementation. Fields (and field-like properties) are covered,
and stores can be either
 - ordinary assignments, `Foo = x`,
 - object initializers, `new C() { Foo = x }`, or
 - field initializers, `int Foo = x`.

For field initializers, we need to synthesize calls (`SynthesizedCall`),
callables (`SynthesizedCallable`), parameters (`InstanceParameterNode`), and
arguments (`SynthesizedThisArgumentNode`), as the C# extractor does not (yet)
extract such entities. For example, in

```
class C
{
    int Field1 = 1;
    int Field2 = 2;

    C() { }
}
```

there is a synthesized call from the constructor `C`, with a synthesized `this`
argument, and the targets of that call are two synthesized callables with bodies
`this.Field1 = 1` and `this.Field2 = 2`, respectively.

A consequence of this is that `DataFlowCallable` is no longer an alias for
`DotNet::Callable`, but instead an IPA type.
2019-08-16 15:49:37 +02:00
Arthur Baars
af68fd4904 Merge pull request #1408 from calumgrant/cs/suppress-null-expr
C#: C#8 Nullable expressions and type annotations
2019-06-28 19:21:46 +02:00
Calum Grant
76454ed68a C#: Fix formatting of arrays and NullableTypes 2019-06-26 20:24:56 +01:00
Calum Grant
abf43dabe5 C#: Address review comments. Fix up toStringWithTypes(), and deprecate predicates in TypeParameterConstraints. 2019-06-26 20:24:56 +01:00
Calum Grant
4aa1947a23 C#: Implement type annotations for nullability, parameter kinds and method returns. 2019-06-26 20:24:55 +01:00
Tom Hvitved
bd03e7a590 C#: Auto format 2019-06-26 19:32:08 +02:00
Tom Hvitved
e70f17f260 C#: Remove uses of deprecated ControlFlowGraph module 2019-06-17 10:23:23 +02:00
Calum Grant
40481fbf9d C#: Make SuppressNullableWarningExpr a nonNullValue, and add a test. 2019-06-11 12:45:50 +01:00
Calum Grant
d48ce859eb C#: Implement nullable warning suppression expressions. 2019-06-11 12:12:29 +01:00
Calum Grant
9678f8eaba C#: Fix control flow graph for using declaration statements. 2019-06-04 18:10:49 +01:00
Calum Grant
20752c80c9 C#: Address review comments 2019-06-04 18:10:49 +01:00
Calum Grant
d6fac7bfb7 C#: Delete file. 2019-06-04 18:10:49 +01:00
Calum Grant
fa89d2b845 C#: Update stats and test output. 2019-06-04 18:10:49 +01:00
Calum Grant
923fbe4c9e C#: Implement QL model for using declarations, introducing UsingBlockStmt and a UsingDeclStmt. 2019-06-04 18:10:49 +01:00
Calum Grant
ac3a06f77b C#: Implement null coalescing assignment operator 2019-06-04 18:10:49 +01:00
Calum Grant
599a5b1eef C#: Make @local_function @modifiable, make LocalFunction extend Modifiable, and extract modifiers for local functions. 2019-06-04 18:10:49 +01:00