From 12a597a35933ffbf66f25f090eba4aab9d09842d Mon Sep 17 00:00:00 2001 From: jfrijters Date: Thu, 27 May 2010 08:31:46 +0000 Subject: [PATCH] When we're statically compiling, register the TypeBuilder -> TypeWrapper early on, to support cyclic dependency compilation. --- runtime/DynamicTypeWrapper.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/DynamicTypeWrapper.cs b/runtime/DynamicTypeWrapper.cs index 3a8e49ac..bb364e55 100644 --- a/runtime/DynamicTypeWrapper.cs +++ b/runtime/DynamicTypeWrapper.cs @@ -800,6 +800,9 @@ namespace IKVM.Internal } } #if STATIC_COMPILER + // When we're statically compiling, we associate the typeBuilder with the wrapper. This enables types in referenced assemblies to refer back to + // types that we're currently compiling (i.e. a cyclic dependency between the currently assembly we're compiling and a referenced assembly). + wrapper.GetClassLoader().SetWrapperForType(typeBuilder, wrapper); if (outer != null && cantNest) { AttributeHelper.SetNonNestedOuterClass(typeBuilder, outerClassWrapper.Name); @@ -4128,7 +4131,10 @@ namespace IKVM.Internal { Profiler.Leave("TypeBuilder.CreateType"); } +#if !STATIC_COMPILER + // When we're statically compiling we don't need to set the wrapper here, because we've already done so for the typeBuilder earlier. wrapper.GetClassLoader().SetWrapperForType(type, wrapper); +#endif #if STATIC_COMPILER wrapper.FinishGhostStep2(); #endif