Fix #172 - skip qualifiers
This commit is contained in:
parent
f23d17d0b2
commit
08306b9802
4 changed files with 33 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ proc execTest(test: string, flags = "") =
|
|||
execCmd "nim cpp --hints:off " & flags & " -r " & test
|
||||
|
||||
task buildToast, "build toast":
|
||||
execCmd("nim c --hints:off -f nimterop/toast.nim")
|
||||
execCmd("nim c --hints:off nimterop/toast.nim")
|
||||
|
||||
task bt, "build toast":
|
||||
execCmd("nim c --hints:off -d:danger nimterop/toast.nim")
|
||||
|
|
|
|||
|
|
@ -234,7 +234,14 @@ proc getAtom*(node: TSNode): TSNode =
|
|||
if node.getName() in gAtoms:
|
||||
return node
|
||||
elif node.len() != 0:
|
||||
return node[0].getAtom()
|
||||
if node[0].getName() == "type_qualifier":
|
||||
# Skip const, volatile
|
||||
if node.len() > 1:
|
||||
return node[1].getAtom()
|
||||
else:
|
||||
return
|
||||
else:
|
||||
return node[0].getAtom()
|
||||
|
||||
proc getStartAtom*(node: TSNode): int =
|
||||
if not node.isNil:
|
||||
|
|
@ -256,7 +263,14 @@ proc getXCount*(node: TSNode, ntype: string, reverse = false): int =
|
|||
cnode = cnode.tsNodeParent()
|
||||
else:
|
||||
if cnode.len() != 0:
|
||||
cnode = cnode[0]
|
||||
if cnode[0].getName() == "type_qualifier":
|
||||
# Skip const, volatile
|
||||
if cnode.len() > 1:
|
||||
cnode = cnode[1]
|
||||
else:
|
||||
break
|
||||
else:
|
||||
cnode = cnode[0]
|
||||
else:
|
||||
break
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,11 @@ typedef struct SDL_AudioCVT
|
|||
int needed;
|
||||
} SDL_AudioCVT;
|
||||
|
||||
// Issue #172
|
||||
typedef struct {
|
||||
const char* const* x;
|
||||
} SomeType;
|
||||
|
||||
|
||||
|
||||
// DUPLICATES
|
||||
|
|
@ -334,6 +339,11 @@ typedef struct SDL_AudioCVT
|
|||
int needed;
|
||||
} SDL_AudioCVT;
|
||||
|
||||
// Issue #172
|
||||
typedef struct {
|
||||
const char* const* x;
|
||||
} SomeType;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -367,4 +367,9 @@ checkPragmas(GPU_Target, pHeaderBy, istype = false)
|
|||
# Issue #185
|
||||
assert AudioCVT is object
|
||||
testFields(AudioCVT, "needed!cint")
|
||||
checkPragmas(AudioCVT, pHeaderBy, istype = false, "SDL_")
|
||||
checkPragmas(AudioCVT, pHeaderBy, istype = false, "SDL_")
|
||||
|
||||
# Issue #172
|
||||
assert SomeType is object
|
||||
testFields(SomeType, "x!ptr cstring")
|
||||
checkPragmas(SomeType, pHeaderImpBy)
|
||||
Loading…
Add table
Add a link
Reference in a new issue