Make PHP directors work more like other languages

A PHP exception now gets translated to a C++ exception to skips over C++
code to get back to PHP, avoiding the need to gate every directorout
typemap on EG(exception).
This commit is contained in:
Olly Betts 2021-04-22 14:40:21 +12:00
commit 50426aae20
8 changed files with 50 additions and 88 deletions

View file

@ -18,22 +18,7 @@ namespace Swig {
%include "std_string.i"
#ifdef SWIGPHP
%feature("director:except") {
if ($error == FAILURE) {
Swig::DirectorMethodException::raise("$symname");
}
}
%exception {
try { $action }
catch (Swig::DirectorException &) { SWIG_fail; }
}
#endif
#ifdef SWIGPYTHON
#if defined SWIGPHP || defined SWIGPYTHON
%feature("director:except") {
if ($error != NULL) {

View file

@ -17,11 +17,7 @@
%feature("director") Foo;
%feature("director:except") {
#ifndef SWIGPHP
if ($error != NULL) {
#else
if ($error == FAILURE) {
#endif
throw Swig::DirectorMethodException();
}
}