Fix uncompileable code when overloaded methods are used with the director:except feature
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9392 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
79eb884747
commit
1abf0e32a6
1 changed files with 19 additions and 5 deletions
|
|
@ -18,8 +18,10 @@ static int treduce = SWIG_cparse_template_reduce(0);
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h> /* for INT_MAX */
|
#include <limits.h> /* for INT_MAX */
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
class RClass {
|
class RClass {
|
||||||
private:
|
private:
|
||||||
String *temp;
|
String *temp;
|
||||||
public:
|
public:
|
||||||
|
|
@ -143,6 +145,7 @@ private:
|
||||||
|
|
||||||
File *f_directors;
|
File *f_directors;
|
||||||
File *f_directors_h;
|
File *f_directors_h;
|
||||||
|
File *f_directors_helpers;
|
||||||
File *f_runtime;
|
File *f_runtime;
|
||||||
File *f_runtime_h;
|
File *f_runtime_h;
|
||||||
File *f_header;
|
File *f_header;
|
||||||
|
|
@ -418,6 +421,7 @@ public:
|
||||||
f_wrappers = NewString("");
|
f_wrappers = NewString("");
|
||||||
f_directors_h = NewString("");
|
f_directors_h = NewString("");
|
||||||
f_directors = NewString("");
|
f_directors = NewString("");
|
||||||
|
f_directors_helpers = NewString("");
|
||||||
f_initbeforefunc = NewString("");
|
f_initbeforefunc = NewString("");
|
||||||
|
|
||||||
/* Register file targets with the SWIG file handler */
|
/* Register file targets with the SWIG file handler */
|
||||||
|
|
@ -427,6 +431,7 @@ public:
|
||||||
Swig_register_filebyname("init",f_init);
|
Swig_register_filebyname("init",f_init);
|
||||||
Swig_register_filebyname("director",f_directors);
|
Swig_register_filebyname("director",f_directors);
|
||||||
Swig_register_filebyname("director_h",f_directors_h);
|
Swig_register_filebyname("director_h",f_directors_h);
|
||||||
|
Swig_register_filebyname("director_helpers",f_directors_helpers);
|
||||||
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
|
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
|
||||||
|
|
||||||
modvar = 0;
|
modvar = 0;
|
||||||
|
|
@ -465,6 +470,10 @@ public:
|
||||||
Printf(f_directors_h, " class Director;\n");
|
Printf(f_directors_h, " class Director;\n");
|
||||||
Printf(f_directors_h, "}\n\n");
|
Printf(f_directors_h, "}\n\n");
|
||||||
|
|
||||||
|
Printf(f_directors_helpers, "/* ---------------------------------------------------\n");
|
||||||
|
Printf(f_directors_helpers, " * C++ director class helpers\n");
|
||||||
|
Printf(f_directors_helpers, " * --------------------------------------------------- */\n\n");
|
||||||
|
|
||||||
Printf(f_directors, "\n\n");
|
Printf(f_directors, "\n\n");
|
||||||
Printf(f_directors, "/* ---------------------------------------------------\n");
|
Printf(f_directors, "/* ---------------------------------------------------\n");
|
||||||
Printf(f_directors, " * C++ director class methods\n");
|
Printf(f_directors, " * C++ director class methods\n");
|
||||||
|
|
@ -522,6 +531,7 @@ public:
|
||||||
Dump(f_header,f_runtime);
|
Dump(f_header,f_runtime);
|
||||||
|
|
||||||
if (directorsEnabled()) {
|
if (directorsEnabled()) {
|
||||||
|
Dump(f_directors_helpers, f_runtime);
|
||||||
Dump(f_directors, f_runtime);
|
Dump(f_directors, f_runtime);
|
||||||
Dump(f_directors_h, f_runtime_h);
|
Dump(f_directors_h, f_runtime_h);
|
||||||
Printf(f_runtime_h, "\n");
|
Printf(f_runtime_h, "\n");
|
||||||
|
|
@ -2188,11 +2198,11 @@ public:
|
||||||
* --------------------------------------------------------------- */
|
* --------------------------------------------------------------- */
|
||||||
|
|
||||||
void exceptionSafeMethodCall(String *className, Node *n, Wrapper *w, int argc, String *args) {
|
void exceptionSafeMethodCall(String *className, Node *n, Wrapper *w, int argc, String *args) {
|
||||||
|
|
||||||
Wrapper *body = NewWrapper();
|
Wrapper *body = NewWrapper();
|
||||||
Wrapper *rescue = NewWrapper();
|
Wrapper *rescue = NewWrapper();
|
||||||
|
|
||||||
String *methodName = Getattr(n, "sym:name");
|
String *methodName = Getattr(n, "sym:name");
|
||||||
|
|
||||||
String *bodyName = NewStringf("%s_%s_body", className, methodName);
|
String *bodyName = NewStringf("%s_%s_body", className, methodName);
|
||||||
String *rescueName = NewStringf("%s_%s_rescue", className, methodName);
|
String *rescueName = NewStringf("%s_%s_rescue", className, methodName);
|
||||||
String *depthCountName = NewStringf("%s_%s_call_depth", className, methodName);
|
String *depthCountName = NewStringf("%s_%s_call_depth", className, methodName);
|
||||||
|
|
@ -2207,7 +2217,7 @@ public:
|
||||||
{
|
{
|
||||||
// Declare a global to hold the depth count
|
// Declare a global to hold the depth count
|
||||||
if (!Getattr(n,"sym:nextSibling")) {
|
if (!Getattr(n,"sym:nextSibling")) {
|
||||||
Printf(f_directors, "static int %s = 0;\n", depthCountName);
|
Printf(body->def, "static int %s = 0;\n", depthCountName);
|
||||||
|
|
||||||
// Function body
|
// Function body
|
||||||
Printf(body->def, "VALUE %s(VALUE data) {\n", bodyName);
|
Printf(body->def, "VALUE %s(VALUE data) {\n", bodyName);
|
||||||
|
|
@ -2258,8 +2268,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump wrapper code
|
// Dump wrapper code
|
||||||
Wrapper_print(body, f_directors);
|
Wrapper_print(body, f_directors_helpers);
|
||||||
Wrapper_print(rescue, f_directors);
|
Wrapper_print(rescue, f_directors_helpers);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2304,6 +2314,10 @@ public:
|
||||||
pure_virtual = true;
|
pure_virtual = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String *overnametmp = NewString(Getattr(n,"sym:name"));
|
||||||
|
if (Getattr(n, "sym:overloaded")) {
|
||||||
|
Printf(overnametmp, "::%s", Getattr(n, "sym:overname"));
|
||||||
|
}
|
||||||
|
|
||||||
classname = Getattr(parent, "sym:name");
|
classname = Getattr(parent, "sym:name");
|
||||||
type = Getattr(n, "type");
|
type = Getattr(n, "type");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue