From 33ce83ccfff1e5f4ec4acd25770ab06dd09cdb6b Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Thu, 2 May 2019 20:08:20 +0100 Subject: [PATCH] Improve formatting of TypeMapDatabase.cs. --- src/Generator/Types/TypeMapDatabase.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Generator/Types/TypeMapDatabase.cs b/src/Generator/Types/TypeMapDatabase.cs index dfe546ff..38b8b622 100644 --- a/src/Generator/Types/TypeMapDatabase.cs +++ b/src/Generator/Types/TypeMapDatabase.cs @@ -52,6 +52,7 @@ namespace CppSharp.Types public bool FindTypeMap(Type type, out TypeMap typeMap) { + // Looks up the type in the cache map. if (typeMaps.ContainsKey(type)) { typeMap = typeMaps[type]; @@ -65,6 +66,7 @@ namespace CppSharp.Types if (specialization != null && FindTypeMap(specialization, out typeMap)) return true; + if (template.Template.TemplatedDecl != null) { if (FindTypeMap(template.Template.TemplatedDecl, @@ -73,14 +75,17 @@ namespace CppSharp.Types typeMap.Type = type; return true; } + return false; } } Type desugared = type.Desugar(); desugared = (desugared.GetFinalPointee() ?? desugared).Desugar(); + bool printExtra = desugared.IsPrimitiveType() || (desugared.GetFinalPointee() ?? desugared).Desugar().IsPrimitiveType(); + var typePrinter = new CppTypePrinter { PrintTypeQualifiers = printExtra, @@ -89,6 +94,7 @@ namespace CppSharp.Types }; foreach (var resolveTypeDefs in new[] { true, false }) + { foreach (var typePrintScopeKind in new[] { TypePrintScopeKind.Local, TypePrintScopeKind.Qualified }) { @@ -101,6 +107,7 @@ namespace CppSharp.Types return true; } } + } typeMap = null; var typedef = type as TypedefType;