diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2016-06-25 20:46:58 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2016-06-25 20:46:58 +0100 |
commit | 91a79c8df2fe8a2d4d6bebc7fde44e068735b333 (patch) | |
tree | 76ee8c9b9289d142ede0217faef0183cf25c1543 | |
parent | 9f37796e80f9b4b65e037df2ad3067dedf4fcebd (diff) | |
parent | 4f1c4910905c72aceea08ffa92187b771cd6cf45 (diff) | |
download | swig-91a79c8df2fe8a2d4d6bebc7fde44e068735b333.tar.gz |
Merge branch 'ahnolds-implicittest'
* ahnolds-implicittest:
Fixing implicitconv handling for fastdispatch and castmode
-rw-r--r-- | Source/Modules/overload.cxx | 16 |
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); } |