Merge branch 'typecheck-null-nonpointers'
* typecheck-null-nonpointers: Fix overloading for non-pointers and NULL - MzScheme Overloading for non-pointers and NULL - Chicken Fix overloading for non-pointers and NULL - Scilab Fix overloading for non-pointers and NULL - R Fix overloading for non-pointers and NULL - Php Fix overloading for non-pointers and NULL - Octave Fix overloading for non-pointers and NULL - Lua Overloading for non-pointers and NULL - Javascript Fix overloading for non-pointers and NULL - Guile Fix overloading for non-pointers and NULL - Tcl Fix overloading for non-pointers and NULL - Perl Fix overloading for non-pointers and NULL - Ruby Add test for overloading and NULL Correct Python implicitconv code Fix typecheck typemaps for non-pointers and NULL
This commit is contained in:
commit
6a80ec314a
40 changed files with 685 additions and 87 deletions
|
|
@ -1664,37 +1664,29 @@ void R::dispatchFunction(Node *n) {
|
|||
Printf(stdout, "<rtypecheck>%s\n", tmcheck);
|
||||
}
|
||||
Printf(f->code, "%s(%s)",
|
||||
j == 0? "" : " && ",
|
||||
j == 0 ? "" : " && ",
|
||||
tmcheck);
|
||||
p = Getattr(p, "tmap:in:next");
|
||||
continue;
|
||||
}
|
||||
// Below should be migrated into rtypecheck typemaps
|
||||
if (tm) {
|
||||
if (Strcmp(tm,"numeric")==0) {
|
||||
Printf(f->code, "%sis.numeric(argv[[%d]])",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1);
|
||||
}
|
||||
else if (Strcmp(tm,"integer")==0) {
|
||||
Printf(f->code, "%s(is.integer(argv[[%d]]) || is.numeric(argv[[%d]]))",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1, j+1);
|
||||
}
|
||||
else if (Strcmp(tm,"character")==0) {
|
||||
Printf(f->code, "%sis.character(argv[[%d]])",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1);
|
||||
}
|
||||
else {
|
||||
Printf(f->code, "%sextends(argtypes[%d], '%s')",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1,
|
||||
tm);
|
||||
Printf(f->code, "%s", j == 0 ? "" : " && ");
|
||||
if (Strcmp(tm, "numeric") == 0) {
|
||||
Printf(f->code, "is.numeric(argv[[%d]])", j+1);
|
||||
} else if (Strcmp(tm, "integer") == 0) {
|
||||
Printf(f->code, "(is.integer(argv[[%d]]) || is.numeric(argv[[%d]]))", j+1, j+1);
|
||||
} else if (Strcmp(tm, "character") == 0) {
|
||||
Printf(f->code, "is.character(argv[[%d]])", j+1);
|
||||
} else {
|
||||
if (SwigType_ispointer(Getattr(p, "type")))
|
||||
Printf(f->code, "(extends(argtypes[%d], '%s') || is.null(argv[[%d]]))", j+1, tm, j+1);
|
||||
else
|
||||
Printf(f->code, "extends(argtypes[%d], '%s')", j+1, tm);
|
||||
}
|
||||
}
|
||||
if (!SwigType_ispointer(Getattr(p, "type"))) {
|
||||
Printf(f->code, " && length(argv[[%d]]) == 1",
|
||||
j+1);
|
||||
Printf(f->code, " && length(argv[[%d]]) == 1", j+1);
|
||||
}
|
||||
p = Getattr(p, "tmap:in:next");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue