Skip to content

Commit 5194808

Browse files
committed
Remove unused NestedClassEmitter
1 parent 7439e03 commit 5194808

File tree

3 files changed

+1
-82
lines changed

3 files changed

+1
-82
lines changed

src/Castle.Core.Tests/DynamicProxy.Tests/ClassEmitterTestCase.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2004-2021 Castle Project - http://www.castleproject.org/
1+
// Copyright 2004-2025 Castle Project - http://www.castleproject.org/
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -157,22 +157,5 @@ public void NoCustomCtorForInterfaces()
157157
emitter.CreateConstructor();
158158
});
159159
}
160-
161-
[Test]
162-
public void NestedInterface()
163-
{
164-
ClassEmitter outerEmitter = new ClassEmitter(generator.ProxyBuilder.ModuleScope, "IOuter", null, Type.EmptyTypes,
165-
TypeAttributes.Interface | TypeAttributes.Abstract | TypeAttributes.Public, false);
166-
NestedClassEmitter innerEmitter = new NestedClassEmitter(outerEmitter, "IInner",
167-
TypeAttributes.Interface | TypeAttributes.Abstract | TypeAttributes.NestedPublic, null, Type.EmptyTypes);
168-
innerEmitter.CreateMethod("MyMethod", MethodAttributes.Public | MethodAttributes.Abstract | MethodAttributes.Virtual,
169-
typeof(void), Type.EmptyTypes);
170-
Type inner = innerEmitter.BuildType();
171-
Type outer = outerEmitter.BuildType();
172-
Assert.IsTrue(inner.IsInterface);
173-
MethodInfo method = inner.GetMethod("MyMethod");
174-
Assert.IsNotNull(method);
175-
Assert.AreSame(inner, outer.GetNestedType("IInner", BindingFlags.Public));
176-
}
177160
}
178161
}

src/Castle.Core/DynamicProxy/Generators/Emitters/AbstractTypeEmitter.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ internal abstract class AbstractTypeEmitter
3636

3737
private readonly List<MethodEmitter> methods;
3838

39-
private readonly List<NestedClassEmitter> nested;
4039
private readonly List<PropertyEmitter> properties;
4140
private readonly TypeBuilder typeBuilder;
4241

@@ -45,7 +44,6 @@ internal abstract class AbstractTypeEmitter
4544
protected AbstractTypeEmitter(TypeBuilder typeBuilder)
4645
{
4746
this.typeBuilder = typeBuilder;
48-
nested = new List<NestedClassEmitter>();
4947
methods = new List<MethodEmitter>();
5048
constructors = new List<ConstructorEmitter>();
5149
properties = new List<PropertyEmitter>();
@@ -84,22 +82,12 @@ public void AddCustomAttributes(IEnumerable<CustomAttributeInfo> additionalAttri
8482
}
8583
}
8684

87-
public void AddNestedClass(NestedClassEmitter nestedClass)
88-
{
89-
nested.Add(nestedClass);
90-
}
91-
9285
public virtual Type BuildType()
9386
{
9487
EnsureBuildersAreInAValidState();
9588

9689
var type = CreateType(typeBuilder);
9790

98-
foreach (var builder in nested)
99-
{
100-
builder.BuildType();
101-
}
102-
10391
return type;
10492
}
10593

src/Castle.Core/DynamicProxy/Generators/Emitters/NestedClassEmitter.cs

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)