Skip to content

Commit bd1ca74

Browse files
committed
Make each Reference subclass' choice of owner explicit
1 parent e2b6007 commit bd1ca74

File tree

7 files changed

+9
-13
lines changed

7 files changed

+9
-13
lines changed

src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/ArgumentReference.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST
2424
internal class ArgumentReference : TypeReference
2525
{
2626
public ArgumentReference(Type argumentType)
27-
: base(argumentType)
27+
: base(null, argumentType)
2828
{
2929
Position = -1;
3030
}
3131

3232
public ArgumentReference(Type argumentType, int position)
33-
: base(argumentType)
33+
: base(null, argumentType)
3434
{
3535
Position = position;
3636
}

src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/AsTypeReference.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ internal class AsTypeReference : Reference
2727
private readonly Type type;
2828

2929
public AsTypeReference(Reference reference, Type type)
30+
: base(SelfReference.Self)
3031
{
3132
this.reference = reference;
3233
this.type = type;

src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/ByRefReference.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal class ByRefReference : TypeReference
2727
private readonly LocalReference localReference;
2828

2929
public ByRefReference(LocalReference localReference)
30-
: base(localReference.Type)
30+
: base(null, localReference.Type)
3131
{
3232
this.localReference = localReference;
3333
}

src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/FieldReference.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ internal class FieldReference : Reference
2828
private readonly bool isStatic;
2929

3030
public FieldReference(FieldInfo field)
31+
: base(SelfReference.Self)
3132
{
3233
this.field = field;
3334
if ((field.Attributes & FieldAttributes.Static) != 0)
@@ -38,6 +39,7 @@ public FieldReference(FieldInfo field)
3839
}
3940

4041
public FieldReference(FieldBuilder fieldBuilder)
42+
: base(SelfReference.Self)
4143
{
4244
this.fieldBuilder = fieldBuilder;
4345
field = fieldBuilder;

src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/LocalReference.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ internal class LocalReference : TypeReference
2525
{
2626
private LocalBuilder? localBuilder;
2727

28-
public LocalReference(Type type) : base(type)
28+
public LocalReference(Type type)
29+
: base(null, type)
2930
{
3031
}
3132

src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/Reference.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST
2020

2121
internal abstract class Reference : IExpression
2222
{
23-
protected Reference? owner = SelfReference.Self;
24-
25-
protected Reference()
26-
{
27-
}
23+
protected Reference? owner;
2824

2925
protected Reference(Reference? owner)
3026
{

src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/TypeReference.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ internal abstract class TypeReference : Reference
2020
{
2121
private readonly Type type;
2222

23-
protected TypeReference(Type argumentType) : this(null, argumentType)
24-
{
25-
}
26-
2723
protected TypeReference(Reference owner, Type type) : base(owner)
2824
{
2925
this.type = type;

0 commit comments

Comments
 (0)