[glibmm/gmmproc-refactor] When wrapping a function as a static method, check constructors also.



commit 49037c4430a47f9137530adc10064b7b0bfb232a
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Mon Jul 9 22:20:49 2012 +0200

    When wrapping a function as a static method, check constructors also.

 tools/pm/Common/WrapParser.pm |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/tools/pm/Common/WrapParser.pm b/tools/pm/Common/WrapParser.pm
index 722afb5..10e1d05 100644
--- a/tools/pm/Common/WrapParser.pm
+++ b/tools/pm/Common/WrapParser.pm
@@ -808,17 +808,18 @@ sub _on_wrap_method ($)
 
     unless (defined $gir_func)
     {
-# TODO: Check if we have any function outside C class wrapped
-# TODO continued: in C++ class.
       $gir_func = $gir_namespace->get_g_function_by_name ($c_function_name);
 
-      unless (defined $gir_func)
+      # Check if we are wrapping a C constructor with
+      # _WRAP_METHOD. Sensible only for static methods.
+      if (not defined ($gir_func) and $cxx_function->get_static ())
       {
-        $self->fixed_error ('No such method: ' . $c_function_name);
+        $gir_func = $gir_entity->get_g_constructor_by_name ($c_function_name);
       }
-      else
+
+      unless (defined ($gir_func))
       {
-        $self->fixed_warning ('Found a function, but it is outside class.');
+        $self->fixed_error ('No such method: ' . $c_function_name);
       }
     }
   }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]