[php] Tidy up code which processes in typemaps
The only functional change is that we now recover after WARN_TYPEMAP_IN_UNDEF better (or at least like most of the other SWIG backends do).
This commit is contained in:
parent
4c7febfb80
commit
98b8578731
1 changed files with 21 additions and 23 deletions
|
|
@ -1211,23 +1211,25 @@ public:
|
||||||
// This may mean looking at Language::memberfunctionHandler
|
// This may mean looking at Language::memberfunctionHandler
|
||||||
|
|
||||||
for (i = 0, p = l; i < num_arguments; i++) {
|
for (i = 0, p = l; i < num_arguments; i++) {
|
||||||
String *source;
|
|
||||||
|
|
||||||
/* Skip ignored arguments */
|
/* Skip ignored arguments */
|
||||||
while (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
while (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
||||||
p = Getattr(p, "tmap:in:next");
|
p = Getattr(p, "tmap:in:next");
|
||||||
}
|
}
|
||||||
|
|
||||||
SwigType *pt = Getattr(p, "type");
|
|
||||||
|
|
||||||
source = NewStringf("args[%d]", i);
|
|
||||||
|
|
||||||
/* Check if optional */
|
/* Check if optional */
|
||||||
if (i >= num_required) {
|
if (i >= num_required) {
|
||||||
Printf(f->code, "\tif(arg_count > %d) {\n", i);
|
Printf(f->code, "\tif(arg_count > %d) {\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tm = Getattr(p, "tmap:in"))) {
|
tm = Getattr(p, "tmap:in");
|
||||||
|
if (!tm) {
|
||||||
|
SwigType *pt = Getattr(p, "type");
|
||||||
|
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
|
||||||
|
p = nextSibling(p);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String *source = NewStringf("args[%d]", i);
|
||||||
Replaceall(tm, "$input", source);
|
Replaceall(tm, "$input", source);
|
||||||
Setattr(p, "emit:input", source);
|
Setattr(p, "emit:input", source);
|
||||||
Printf(f->code, "%s\n", tm);
|
Printf(f->code, "%s\n", tm);
|
||||||
|
|
@ -1237,17 +1239,13 @@ public:
|
||||||
Printf(f->code, "\t return;\n");
|
Printf(f->code, "\t return;\n");
|
||||||
Printf(f->code, "\t}\n");
|
Printf(f->code, "\t}\n");
|
||||||
}
|
}
|
||||||
p = Getattr(p, "tmap:in:next");
|
|
||||||
if (i >= num_required) {
|
if (i >= num_required) {
|
||||||
Printf(f->code, "}\n");
|
Printf(f->code, "}\n");
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
} else {
|
p = Getattr(p, "tmap:in:next");
|
||||||
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
|
|
||||||
}
|
|
||||||
if (i >= num_required) {
|
|
||||||
Printf(f->code, "\t}\n");
|
|
||||||
}
|
|
||||||
Delete(source);
|
Delete(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue