csharp : noexcept method can't raise Swig::DirectorPureVirtualException

This commit is contained in:
Christophe Duvernois 2017-04-28 11:45:36 +02:00
commit 9dcf10138e

View file

@ -403,6 +403,7 @@ public:
if (directorsEnabled()) { if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n"); Printf(f_runtime, "#define SWIG_DIRECTORS\n");
Printf(f_runtime, "#include <assert.h>\n");
/* Emit initial director header and director code: */ /* Emit initial director header and director code: */
Swig_banner(f_directors_h); Swig_banner(f_directors_h);
@ -3934,9 +3935,14 @@ public:
Printf(w->code, "return %s;\n", super_call); Printf(w->code, "return %s;\n", super_call);
} }
Delete(super_call); Delete(super_call);
} else {
if (Getattr(n, "noexcept")) {
Printf(w->code, " //can't throw exception here\n");
Printf(w->code, " assert(0 && \"swig DirectorPureVirtualException %s::%s\");", SwigType_namestr(c_classname), SwigType_namestr(name));
} else { } else {
Printf(w->code, " throw Swig::DirectorPureVirtualException(\"%s::%s\");\n", SwigType_namestr(c_classname), SwigType_namestr(name)); Printf(w->code, " throw Swig::DirectorPureVirtualException(\"%s::%s\");\n", SwigType_namestr(c_classname), SwigType_namestr(name));
} }
}
if (!ignored_method) if (!ignored_method)
Printf(w->code, "} else {\n"); Printf(w->code, "} else {\n");