1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// References: member access, conditional access, invocation, generic invocation, this/base, global::.
namespace Syntax.Access;
class AccessTarget
{
public int Count;
public string? Name { get; set; }
public AccessTarget? Next;
public int Compute() => Count;
public T Generic<T>() => default!;
public static AccessTarget Shared = new();
public int this[int i] => i;
public void Hook2() { }
public AccessTarget Self() => this;
}
class AccessBase
{
public int BaseField;
public virtual void Hook() { }
}
class AccessUser : AccessBase
{
private readonly AccessTarget target = new();
private AccessTarget TargetProp { get; set; } = new();
private static AccessTarget SharedProp { get; set; } = new();
public async Task Run()
{
object o = target;
_ = target.Count;
target.Name = "x";
target.Compute();
target.Generic<int>();
_ = target?.Compute();
_ = target?.Next?.Name;
_ = target.Next!.Count;
_ = target[0];
this.Run2();
this.BaseField = 1;
base.Hook();
_ = global::Syntax.Access.AccessTarget.Shared.Compute();
_ = AccessTarget.Shared.Next?.Compute();
_ = target.Next.Next.Compute();
Action a = target.Hook2;
a();
_ = new AccessTarget().Compute();
_ = ((AccessTarget)o).Compute();
_ = (await Load()).Compute();
var v = new AccessTarget();
_ = v.Compute();
AccessTarget ex = new AccessTarget();
_ = ex.Compute();
UseParam(target);
_ = TargetProp.Compute();
_ = SharedProp.Compute();
_ = target.Next.Compute();
_ = target?[0];
_ = target.Self().Compute();
}
private void Run2() { }
private void UseParam(AccessTarget p) => p.Compute();
public Task<AccessTarget> Load() => Task.FromResult(target);
}