summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAlec Cooper <ahnolds@gmail.com>2016-01-29 22:00:57 -0500
committerAlec Cooper <ahnolds@gmail.com>2016-06-23 08:06:14 -0400
commit4f1c4910905c72aceea08ffa92187b771cd6cf45 (patch)
treeb2d525576b4c5c30f8d7bceaf2c070317199e3ac /Source
parent86fd5c98583936c4ea25caf341ec30d2379d05e7 (diff)
downloadswig-4f1c4910905c72aceea08ffa92187b771cd6cf45.tar.gz
Fixing implicitconv handling for fastdispatch and castmode
Diffstat (limited to 'Source')
-rw-r--r--Source/Modules/overload.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/Source/Modules/overload.cxx b/Source/Modules/overload.cxx
index dd3ca4972..330294efd 100644
--- a/Source/Modules/overload.cxx
+++ b/Source/Modules/overload.cxx
@@ -433,6 +433,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
int fn = 0;
Node *ni = Getitem(dispatch, i);
Parm *pi = Getattr(ni, "wrap:parms");
+ bool implicitconvtypecheckoff = GetFlag(ni, "implicitconvtypecheckoff") != 0;
int num_required = emit_num_required(pi);
int num_arguments = emit_num_arguments(pi);
if (num_arguments > *maxargs)
@@ -476,6 +477,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
String *tm = Getattr(pj, "tmap:typecheck");
if (tm) {
+ tm = Copy(tm);
/* normalise for comparison later */
Replaceid(tm, Getattr(pj, "lname"), "_v");
@@ -528,13 +530,14 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
String *tmp = NewStringf(argv_template_string, j);
String *conv = Getattr(pj, "implicitconv");
- if (conv) {
+ if (conv && !implicitconvtypecheckoff) {
Replaceall(tm, "$implicitconv", conv);
} else {
Replaceall(tm, "$implicitconv", "0");
}
Replaceall(tm, "$input", tmp);
Printv(f, "{\n", tm, "}\n", NIL);
+ Delete(tm);
fn = i + 1;
Printf(f, "if (!_v) goto check_%d;\n", fn);
Printf(f, "_ranki += _v*_pi;\n");
@@ -574,6 +577,9 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
if (fn)
Printf(f, "check_%d:\n\n", fn);
+ if (implicitconvtypecheckoff)
+ Delattr(ni, "implicitconvtypecheckoff");
+
Delete(lfmt);
Delete(coll);
}
@@ -607,6 +613,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
int fn = 0;
Node *ni = Getitem(dispatch, i);
Parm *pi = Getattr(ni, "wrap:parms");
+ bool implicitconvtypecheckoff = GetFlag(ni, "implicitconvtypecheckoff") != 0;
int num_required = emit_num_required(pi);
int num_arguments = emit_num_arguments(pi);
if (num_arguments > *maxargs)
@@ -646,6 +653,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
String *tm = Getattr(pj, "tmap:typecheck");
if (tm) {
+ tm = Copy(tm);
/* normalise for comparison later */
Replaceid(tm, Getattr(pj, "lname"), "_v");
@@ -699,13 +707,14 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
String *tmp = NewStringf(argv_template_string, j);
String *conv = Getattr(pj, "implicitconv");
- if (conv) {
+ if (conv && !implicitconvtypecheckoff) {
Replaceall(tm, "$implicitconv", conv);
} else {
Replaceall(tm, "$implicitconv", "0");
}
Replaceall(tm, "$input", tmp);
Printv(f, "{\n", tm, "}\n", NIL);
+ Delete(tm);
fn = i + 1;
Printf(f, "if (!_v) goto check_%d;\n", fn);
}
@@ -737,6 +746,9 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
if (fn)
Printf(f, "check_%d:\n\n", fn);
+ if (implicitconvtypecheckoff)
+ Delattr(ni, "implicitconvtypecheckoff");
+
Delete(lfmt);
Delete(coll);
}