[OCaml] Fix handling of exception specifications for director classes

The OCaml module was generating invalid code for director classes
which contain methods with exception specifications. The fix is based
on some of the code in python.cxx's classDirectorMethod().

This commit fixes compilation failures for a number of director unit
tests.

Add director_exception_catches_runme.ml,
director_exception_nothrow_runme.ml, and director_ignore_runme.ml.
This commit is contained in:
Zackery Spytz 2019-01-26 05:58:38 -07:00
commit 35663b1622
5 changed files with 79 additions and 9 deletions

View file

@ -0,0 +1,15 @@
open Swig
open Director_exception_catches
exception CustomException of string
let new_MyClass ob meth args =
match meth with
| "description" -> raise (CustomException "CustomException thrown in description().")
| _ -> (invoke ob) meth args
let b = new_derived_object new_BaseClass (new_MyClass) '()
try
ignore (_BaseClass_call_description (b)); assert false
with CustomException s ->
assert (s = "CustomException thrown in description().")