From 31fe7760ad98ec2c81eba1ac28a8d6040ba3cec5 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 12 Aug 2013 01:25:37 +0300 Subject: [PATCH] Added 3 hacks so that QtCore reaches the end of code generation: 1. If an expression of an enum item is null, count it as non-hex; 2. Do not throw a NotSupported exception when a fixed array of an non-primitive type is encountered; 3. Provide some seemingly correct implementation for CppTypePrinter.VisitTemplateParameterSubstitutionType. Signed-off-by: Dimitar Dobrev --- src/AST/Enumeration.cs | 6 +++++- src/Generator/Generators/CSharp/CSharpTypePrinter.cs | 6 +++--- src/Generator/Types/CppTypePrinter.cs | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/AST/Enumeration.cs b/src/AST/Enumeration.cs index b76ccb51..88acd292 100644 --- a/src/AST/Enumeration.cs +++ b/src/AST/Enumeration.cs @@ -30,7 +30,11 @@ namespace CppSharp.AST public bool IsHexadecimal { get - { + { + if (Expression == null) + { + return false; + } return Expression.Contains("0x") || Expression.Contains("0X"); } } diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 83237d0c..db61bbeb 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -96,9 +96,9 @@ namespace CppSharp.Generators.CSharp if (ContextKind == CSharpTypePrinterContextKind.Native && array.SizeType == ArrayType.ArraySize.Constant) { - PrimitiveType primitive; - if (!array.Type.Desugar().IsPrimitiveType(out primitive)) - throw new NotSupportedException(); + //PrimitiveType primitive; + //if (!array.Type.Desugar().IsPrimitiveType(out primitive)) + // throw new NotSupportedException(); return new CSharpTypePrinterResult() { diff --git a/src/Generator/Types/CppTypePrinter.cs b/src/Generator/Types/CppTypePrinter.cs index 22345d8b..8dc17bb0 100644 --- a/src/Generator/Types/CppTypePrinter.cs +++ b/src/Generator/Types/CppTypePrinter.cs @@ -118,7 +118,7 @@ namespace CppSharp.Types public string VisitTemplateParameterSubstitutionType( TemplateParameterSubstitutionType param, TypeQualifiers quals) { - throw new System.NotImplementedException(); + return param.Replacement.Visit(this); } public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals)