aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-04-16 08:39:52 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-04-16 08:39:52 -0500
commit281d2609122f0697b060c1608fa8df6b70d8edad (patch)
treee688b7caa80315d4f216892e4bc717d00bd3845f
parent6a9a35db61e1e47652fa667ff557555e87a6edeb (diff)
downloadnimterop-varargs.tar.gz
nimterop-varargs.zip
Fix Travis, tests for varargsvarargs
-rw-r--r--nimterop/getters.nim4
-rw-r--r--tests/include/tast2.h8
-rw-r--r--tests/tast2.nim6
3 files changed, 9 insertions, 9 deletions
diff --git a/nimterop/getters.nim b/nimterop/getters.nim
index c971bfc..6cb7651 100644
--- a/nimterop/getters.nim
+++ b/nimterop/getters.nim
@@ -296,9 +296,9 @@ proc getVarargs*(node: TSNode): bool =
# ... is an unnamed node, second last node and ) is last node
let
nlen = node.tsNodeChildCount()
- if nlen > 1:
+ if nlen > 1.uint32:
let
- nval = node.tsNodeChild(nlen - 2).getName()
+ nval = node.tsNodeChild(nlen - 2.uint32).getName()
if nval == "...":
result = true
diff --git a/tests/include/tast2.h b/tests/include/tast2.h
index fe78146..1c1e935 100644
--- a/tests/include/tast2.h
+++ b/tests/include/tast2.h
@@ -109,7 +109,7 @@ typedef enum VSPresetFormat {
// Proc vars
void
- *(*pcre_malloc)(size_t),
+ *(*pcre_malloc)(size_t, ...),
(*pcre_free)(void *),
*(*pcre_stack_malloc)(size_t);
@@ -144,7 +144,7 @@ struct ucArrType2 {
};
typedef struct fieldfuncfunc {
- int *(*func1)(int f1, int *(*sfunc1)(int f1, int *(*ssfunc1)(int f1)));
+ int *(*func1)(int f1, int *(*sfunc1)(int f1, int *(*ssfunc1)(int f1, ...)));
};
int *func2(int f1, int *(*sfunc2)(int f1, int *(*ssfunc2)(int f1)));
@@ -311,7 +311,7 @@ typedef enum VSPresetFormat {
// Proc vars
void
- *(*pcre_malloc)(size_t),
+ *(*pcre_malloc)(size_t, ...),
(*pcre_free)(void *),
*(*pcre_stack_malloc)(size_t);
@@ -336,7 +336,7 @@ void
int sqlite3_bind_blob(struct A1*, int, const void*, int n, void(*)(void*));
typedef struct fieldfuncfunc {
- int *(*func1)(int f1, int *(*sfunc1)(int f1, int *(*ssfunc1)(int f1)));
+ int *(*func1)(int f1, int *(*sfunc1)(int f1, int *(*ssfunc1)(int f1, ...)));
};
int *func2(int f1, int *(*sfunc2)(int f1, int *(*ssfunc2)(int f1)));
diff --git a/tests/tast2.nim b/tests/tast2.nim
index 46101d5..c49c008 100644
--- a/tests/tast2.nim
+++ b/tests/tast2.nim
@@ -302,8 +302,8 @@ assert pfYUV422P8 == pfYUV420P8 + 1
assert pfRGB27 == cmRGB.VSPresetFormat + 11
assert pfCompatYUY2 == pfCompatBGR32 + 1
-assert pcre_malloc is proc(a1: uint): pointer {.cdecl.}
-checkPragmas(pcre_malloc, @["importc", "cdecl"] & pHeader)
+assert pcre_malloc is proc(a1: uint): pointer {.cdecl, varargs.}
+checkPragmas(pcre_malloc, @["importc", "cdecl", "varargs"] & pHeader)
assert pcre_free is proc(a1: pointer) {.cdecl.}
checkPragmas(pcre_free, @["importc", "cdecl"] & pHeader)
@@ -351,7 +351,7 @@ checkPragmas(ucArrType2, pHeaderBy, istype = false)
assert fieldfuncfunc is object
testFields(fieldfuncfunc,
- "func1!proc (f1: cint; sfunc1: proc (f1: cint; ssfunc1: proc (f1: cint): ptr cint {.cdecl.}): ptr cint {.cdecl.}): ptr cint {.cdecl.}")
+ "func1!proc (f1: cint; sfunc1: proc (f1: cint; ssfunc1: proc (f1: cint): ptr cint {.cdecl, varargs.}): ptr cint {.cdecl.}): ptr cint {.cdecl.}")
assert func2 is proc (f1: cint; sfunc2: proc (f1: cint; ssfunc2: proc (f1: cint): ptr cint {.cdecl.}): ptr cint {.cdecl.}): ptr cint {.cdecl.}