ast2 nested array field

This commit is contained in:
Ganesh Viswanathan 2020-04-14 22:47:33 -05:00
commit 25b07a07ff
3 changed files with 105 additions and 13 deletions

View file

@ -175,6 +175,29 @@ typedef struct {
const char* const* x;
} SomeType;
// Nested #137
typedef struct {
struct NT1 { int f1; } f1;
struct { int f1; } f2;
struct NT3 {
struct {
int f1;
union NU1 {
float f1;
} f2;
enum { NEV1, NEV2, NEV3 } f3;
} f1;
} f3;
struct { int f1; } f4;
union NU2 { int f1; } f5;
union { int f1; } f6;
enum NE1 { NEV4 = 8, NEV5 } f7;
enum { NEV6 = 8 * 8, NEV7 } f8;
} nested;
// DUPLICATES
@ -344,6 +367,29 @@ typedef struct {
const char* const* x;
} SomeType;
// Nested #137
typedef struct {
struct NT1 { int f1; } f1;
struct { int f1; } f2;
struct NT3 {
struct {
int f1;
union NU1 {
float f1;
} f2;
enum { NEV1, NEV2, NEV3 } f3;
} f1;
} f3;
struct { int f1; } f4;
union NU2 { int f1; } f5;
union { int f1; } f6;
enum NE1 { NEV4 = 8, NEV5 } f7;
enum { NEV6 = 8 * 8, NEV7 } f8;
} nested;
#endif

View file

@ -372,4 +372,51 @@ checkPragmas(AudioCVT, pHeaderBy, istype = false, "SDL_")
# Issue #172
assert SomeType is object
testFields(SomeType, "x!ptr cstring")
checkPragmas(SomeType, pHeaderImpBy)
checkPragmas(SomeType, pHeaderImpBy)
# Nested #137
assert NT1 is object
testFields(NT1, "f1!cint")
checkPragmas(NT1, pHeaderBy, istype = false)
assert Type_tast2h1 is object
testFields(Type_tast2h1, "f1!cint")
checkPragmas(Type_tast2h1, pHeaderBy, istype = false)
assert NU1 is object
testFields(NU1, "f1!cfloat")
checkPragmas(NU1, pHeaderBy & @["union"], istype = false)
assert NEV1 == 0
assert NEV2 == 1
assert NEV3 == 2
assert Type_tast2h2 is object
testFields(Type_tast2h2, "f1|f2|f3!cint|NU1|Enum_tast2h1")
checkPragmas(Type_tast2h2, pHeaderBy, istype = false)
assert NT3 is object
testFields(NT3, "f1!Type_tast2h2")
checkPragmas(NT3, pHeaderBy, istype = false)
assert Type_tast2h3 is object
testFields(Type_tast2h3, "f1!cint")
checkPragmas(Type_tast2h3, pHeaderBy, istype = false)
assert NU2 is object
testFields(NU2, "f1!cint")
checkPragmas(NU2, pHeaderBy & @["union"], istype = false)
assert Union_tast2h1 is object
testFields(Union_tast2h1, "f1!cint")
checkPragmas(Union_tast2h1, pHeaderBy & @["union"], istype = false)
assert NEV4 == 8
assert NEV5 == 9
assert NEV6 == 64
assert NEV7 == 65
assert nested is object
testFields(nested, "f1|f2|f3|f4|f5|f6|f7|f8!NT1|Type_tast2h1|NT3|Type_tast2h3|NU2|Union_tast2h1|NE1|Enum_tast2h2")
checkPragmas(nested, pHeaderImpBy)