瀏覽代碼

Fix interrogate bug with detecting parameter coercion possibility

rdb 10 年之前
父節點
當前提交
c9f8ccf901
共有 1 個文件被更改,包括 6 次插入9 次删除
  1. 6 9
      dtool/src/interrogate/interfaceMakerPythonNative.cxx

+ 6 - 9
dtool/src/interrogate/interfaceMakerPythonNative.cxx

@@ -4244,6 +4244,10 @@ write_function_forset(ostream &out,
       for (sii = remaps.begin(); sii != remaps.end(); sii ++) {
       for (sii = remaps.begin(); sii != remaps.end(); sii ++) {
         remap = (*sii);
         remap = (*sii);
         if (!is_remap_coercion_possible(remap)) {
         if (!is_remap_coercion_possible(remap)) {
+          indent(out, indent_level)
+            << "// No coercion possible: ";
+          remap->write_orig_prototype(out, 0, false, (max_num_args - min_num_args));
+          out << "\n";
           continue;
           continue;
         }
         }
 
 
@@ -5143,14 +5147,8 @@ write_function_instance(ostream &out, FunctionRemap *remap,
         method_prefix = classNameFromCppName(this_class_name, false) + string(".");
         method_prefix = classNameFromCppName(this_class_name, false) + string(".");
       }
       }
 
 
-      if (coercion_possible) {
-        if (has_coerce_constructor(obj_type->as_struct_type()) == 0) {
-          // Doesn't actually have a coerce constructor.
-          coercion_possible = false;
-        }
-      }
-
-      if (coercion_possible) {
+      if (coercion_possible &&
+          has_coerce_constructor(obj_type->as_struct_type())) {
         // Call the coercion function directly, which will try to
         // Call the coercion function directly, which will try to
         // extract the pointer directly before trying coercion.
         // extract the pointer directly before trying coercion.
         string coerce_call;
         string coerce_call;
@@ -6527,7 +6525,6 @@ is_remap_coercion_possible(FunctionRemap *remap) {
         // It has a coercion constructor, so go for it.
         // It has a coercion constructor, so go for it.
         return true;
         return true;
       }
       }
-      break;
     }
     }
     ++pn;
     ++pn;
   }
   }