Merge branch 'ZackerySpytz-OCaml-director-ctors'

* ZackerySpytz-OCaml-director-ctors:
  [OCaml] Fix a bug in the ctors of director classes
This commit is contained in:
William S Fulton 2019-02-09 22:28:10 +00:00
commit d7bb500315
5 changed files with 45 additions and 6 deletions

View file

@ -762,14 +762,15 @@ public:
}
}
if (expose_func)
Printf(f_mlbody,
"external %s_f : c_obj list -> c_obj list = \"%s\" ;;\n"
"let %s arg = match %s_f (fnhelper arg) with\n"
" [] -> C_void\n"
if (expose_func) {
Printf(f_mlbody, "external %s_f : c_obj list -> c_obj list = \"%s\" ;;\n", mangled_name, wname);
Printf(f_mlbody, "let %s arg = match %s_f (%s(fnhelper arg)) with\n", mangled_name, mangled_name,
in_constructor && Swig_directorclass(getCurrentClass()) ? "director_core_helper " : "");
Printf(f_mlbody, " [] -> C_void\n"
"| [x] -> (if %s then Gc.finalise \n"
" (fun x -> ignore ((invoke x) \"~\" C_void)) x) ; x\n"
"| lst -> C_list lst ;;\n", mangled_name, wname, mangled_name, mangled_name, newobj ? "true" : "false");
"| lst -> C_list lst ;;\n", newobj ? "true" : "false");
}
if ((!classmode || in_constructor || in_destructor || static_member_function) && expose_func)
Printf(f_mlibody, "val %s : c_obj -> c_obj\n", mangled_name);