From c2968251bd372c0a2bc8b0fb8bb4f33ae44a998f Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Wed, 3 May 2017 10:51:01 -0400 Subject: [PATCH] [objc] Skip generation for subclasses of unsupported types (#250) In such case a warning will be displayed and nothing will be generated. Test added so we can ensure such condition does not stop the generation with an error. --- objcgen/objcgenerator-processor.cs | 4 +++- tests/managed/types.cs | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/objcgen/objcgenerator-processor.cs b/objcgen/objcgenerator-processor.cs index 1079515..38b1e61 100644 --- a/objcgen/objcgenerator-processor.cs +++ b/objcgen/objcgenerator-processor.cs @@ -74,7 +74,9 @@ namespace ObjC { } break; } - return true; + + var base_type = t.BaseType; + return (base_type == null) || base_type.Is ("System", "Object") ? true : IsSupported (base_type); } protected IEnumerable GetTypes (Assembly a) diff --git a/tests/managed/types.cs b/tests/managed/types.cs index 4230cc7..8306016 100644 --- a/tests/managed/types.cs +++ b/tests/managed/types.cs @@ -80,3 +80,10 @@ public static class Type_String public static string NonEmptyString { get { return "Hello World"; } } } +// objc: this type won't be generated (Exception is not supported) but the generation will succeed (with warnings) +public class MyException : Exception { +} + +// objc: this type won't be generated (subclassing an unsupported type) but the generation will succeed (with warnings) +public class MyNextException : MyException { +}