From 9a71bd5ee2b3633c1a4a4176a95fcc1e4c3dd062 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 9 Aug 2005 15:59:30 +0000 Subject: [PATCH] * generator/ClassBase.cs (Validate): Don't fully validate the parent class and interfaces (because we don't want to see the warnings about certain GtkWidget methods in every single library that defines a widget, etc). Instead, use the new ValidateForSubclass() method. (ValidateForSubclass): only validate the signals * generator/InterfaceGen.cs (ValidateForSubclass): for interfaces we need to validate the methods too. svn path=/trunk/gtk-sharp/; revision=48177 --- ChangeLog | 12 ++++++++++++ generator/ClassBase.cs | 25 +++++++++++++++++++++---- generator/InterfaceGen.cs | 17 +++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c1ef253c..f3643920d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-08-09 Dan Winship + + * generator/ClassBase.cs (Validate): Don't fully validate the + parent class and interfaces (because we don't want to see the + warnings about certain GtkWidget methods in every single library + that defines a widget, etc). Instead, use the new + ValidateForSubclass() method. + (ValidateForSubclass): only validate the signals + + * generator/InterfaceGen.cs (ValidateForSubclass): for interfaces + we need to validate the methods too. + 2005-08-09 Dan Winship * generator/OpaqueGen.cs (Generate): Tweak the generated Ref/Unref diff --git a/generator/ClassBase.cs b/generator/ClassBase.cs index a68085636..b3910f602 100644 --- a/generator/ClassBase.cs +++ b/generator/ClassBase.cs @@ -125,15 +125,15 @@ namespace GtkSharp.Generation { public override bool Validate () { - if (Parent != null && !Parent.Validate ()) + if (Parent != null && !Parent.ValidateForSubclass ()) return false; foreach (string iface in interfaces) { - IGeneratable gen = SymbolTable.Table[iface]; - if (!(gen is InterfaceGen)) { + InterfaceGen igen = SymbolTable.Table[iface] as InterfaceGen; + if (igen == null) { Console.WriteLine (QualifiedName + " implements unknown GInterface " + iface); return false; } - if (!gen.Validate ()) { + if (!igen.ValidateForSubclass ()) { Console.WriteLine (QualifiedName + " implements invalid GInterface " + iface); return false; } @@ -194,6 +194,23 @@ namespace GtkSharp.Generation { return true; } + public virtual bool ValidateForSubclass () + { + ArrayList invalids = new ArrayList (); + + foreach (Signal sig in sigs.Values) { + if (!sig.Validate ()) { + Console.WriteLine ("in type " + QualifiedName); + invalids.Add (sig); + } + } + foreach (Signal sig in invalids) + sigs.Remove (sig.Name); + invalids.Clear (); + + return true; + } + public bool IsDeprecated { get { return deprecated; diff --git a/generator/InterfaceGen.cs b/generator/InterfaceGen.cs index 7fee5923b..2c0e2bebe 100644 --- a/generator/InterfaceGen.cs +++ b/generator/InterfaceGen.cs @@ -52,6 +52,23 @@ namespace GtkSharp.Generation { } } + public override bool ValidateForSubclass () + { + ArrayList invalids = new ArrayList (); + + foreach (Method method in methods.Values) { + if (!method.Validate ()) { + Console.WriteLine ("in type " + QualifiedName); + invalids.Add (method); + } + } + foreach (Method method in invalids) + methods.Remove (method.Name); + invalids.Clear (); + + return base.ValidateForSubclass (); + } + string IfaceName { get { return Name + "Iface";