generator: Add new keyword to GType property if it hides parent

If the parent already has a GType property, add a "new" keywords to hide
it.

This eliminates a lot of warnings when using classes derived from
Opaque. Closes issue #100.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
This commit is contained in:
Stephan Sundermann 2014-03-26 02:20:58 +01:00 committed by Bertrand Lorentz
parent 0563af1c25
commit 40b90d2407

View File

@ -128,7 +128,7 @@ namespace GtkSharp.Generation {
if (Name == "ToString" && Parameters.Count == 0 && (!(container_type is InterfaceGen)|| implementor != null))
sw.Write("override ");
else if (Name == "GetGType" && container_type is ObjectGen)
else if (Name == "GetGType" && (container_type is ObjectGen || (container_type.Parent != null && container_type.Parent.Methods.ContainsKey ("GetType"))))
sw.Write("new ");
else if (Modifiers == "new " || (dup != null && ((dup.Signature != null && Signature != null && dup.Signature.ToString() == Signature.ToString()) || (dup.Signature == null && Signature == null))))
sw.Write("new ");