From 2cbb6f1da780acb289fb9f98d7b4adda99fd06c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20Vir=C3=A1gh?= Date: Wed, 13 Oct 2021 11:56:26 +0200 Subject: [PATCH] Fix for #105, stop endless loop, fix static constructor handling #97, #98 Cherry picked from 9091c5b323d8bc034156c8cbd2e325ce0a704714 --- src/IL2C.Core/AssemblyPreparer.cs | 2 +- src/IL2C.Core/Metadata/TypeInformation.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IL2C.Core/AssemblyPreparer.cs b/src/IL2C.Core/AssemblyPreparer.cs index 1900991a..8a636f96 100644 --- a/src/IL2C.Core/AssemblyPreparer.cs +++ b/src/IL2C.Core/AssemblyPreparer.cs @@ -310,7 +310,7 @@ public static PreparedInformations Prepare(TranslateContext translateContext) // All types type => !type.IsIgnoreTranslation, // The methods except type initializer. - method => !(method.IsConstructor && method.IsStatic)); + method => true); } } } diff --git a/src/IL2C.Core/Metadata/TypeInformation.cs b/src/IL2C.Core/Metadata/TypeInformation.cs index 689100f2..e6b94d59 100644 --- a/src/IL2C.Core/Metadata/TypeInformation.cs +++ b/src/IL2C.Core/Metadata/TypeInformation.cs @@ -360,7 +360,7 @@ public bool IsReferenceType public bool IsRequiredTraverse => (this.Member.IsValueType && !this.Member.IsPrimitive && !this.Member.IsPointer && !this.IsByReference && !this.IsEnum && - this.Fields.Any(f => f.FieldType.IsRequiredTraverse)) || + this.Fields.Where(f => f.FieldType.FriendlyName != this.Member.FullName).Any(f => f.FieldType.IsRequiredTraverse)) || this.IsReferenceType; private static int InternalGetStaticSizeOfValue(ITypeInformation type) =>