[Kde-bindings] kdebindings/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sun Oct 3 17:43:52 UTC 2004


CVS commit by rdale: 


* Han Holl's report about a when you pass an incorrect arg type to a QtRuby 
method, it caused a crash has opened a 'can of worms'. This was because there 
was no arg type checking if there was only one candidate method in the 
Smoke runtime. Now that arg type checking is applied to all QtRuby method calls, not 
not just those that after lookup in Smoke map onto a single method, the overloaded 
method resolution via the arg types has had to be greatly improved. This has 
been done, and so the arg type matching is now extremely fussy. 

CCMAIL: kde-bindings at kde.org 


  M +12 -0     ChangeLog   1.116
  M +23 -6     rubylib/qtruby/lib/Qt/qtruby.rb   1.36


--- kdebindings/qtruby/rubylib/qtruby/lib/Qt/qtruby.rb  #1.35:1.36
@@ -254,12 +254,28 @@
                         puts "      #{typename} (#{argtype})" if debug_level >= DebugLevel::High
                         if argtype == 'i'
-                                if typename =~ /^int$/
+                                if typename =~ /^int&?$/
                                         return 1
-                                elsif typename =~ /^(?:short|ushort|uint|long|ulong|signed|unsigned)$/
+                                elsif typename =~ /^(?:short|ushort|uint|long|ulong|signed|unsigned|float|double)$/
                                         return 0
+                                else 
+                                        t = typename.sub(/^const\s+/, '')
+                                        t.sub!(/[&*]$/, '')
+                                        if isEnum(t)
+                                                return 0
+                                        end
                                 end
                         elsif argtype == 'n'
                                 if typename =~ /^(?:float|double)$/
+                                        return 1
+                                elsif typename =~ /^int&?$/
                                         return 0
+                                elsif typename =~ /^(?:short|ushort|uint|long|ulong|signed|unsigned|float|double)$/
+                                        return 0
+                                else 
+                                        t = typename.sub(/^const\s+/, '')
+                                        t.sub!(/[&*]$/, '')
+                                        if isEnum(t)
+                                                return 0
+                                        end
                                 end
                         elsif argtype == 'B'
@@ -316,5 +332,8 @@
                                 elsif classIsa(argtype, t)
                                         return 0
-                                elsif isEnum(argtype) and t =~ /int|uint|long|ulong/
+                                elsif isEnum(argtype) and 
+                                                (t =~ /int|uint|long|ulong|WFlags|WState|ProcessEventsFlags|ComparisonFlags/ or
+                                                t =~ /SFlags|SCFlags|WId|difference_type/ or
+                                                t =~ /KStyleFlags|KonqPopupFlags/)
                                         return 0
                                 end
@@ -422,7 +441,5 @@
                         
                         chosen = nil
-                        if methodIds.length == 1 && method !~ /^operator/
-                                chosen = methodIds[0]
-                        elsif methodIds.length > 0
+                        if methodIds.length > 0
                                 best_match = -1
                                 methodIds.each do

--- kdebindings/qtruby/ChangeLog  #1.115:1.116
@@ -1,4 +1,16 @@
 2004-10-03  Richard Dale  <Richard_Dale at tipitina.demon.co.uk>
 
+ * Han Holl's report about a when you pass an incorrect arg type to a QtRuby
+   method, it caused a crash has opened a 'can of worms'. This was because there
+   was no arg type checking if there was only one candidate method in the
+   Smoke runtime. Now that arg type checking is applied to all QtRuby method calls, not
+   not just those that after lookup in Smoke map onto a single method, the overloaded
+   method resolution via the arg types has had to be greatly improved. This has
+   been done, and so the arg type matching is now extremely fussy.
+
+ CCMAIL: kde-bindings at kde.org
+
+2004-10-03  Richard Dale  <Richard_Dale at tipitina.demon.co.uk>
+
  * An optimization in the overloaded method resolution matching causes a crash;
    instead of throwing a ruby exception when a programming error is made.





More information about the Kde-bindings mailing list