Tests for C nested classes symbol table not being in global space
Tests for 55bda53145
This commit is contained in:
parent
55bda53145
commit
9b0e484b8a
3 changed files with 113 additions and 0 deletions
74
Examples/test-suite/nested_extend_c.i
Normal file
74
Examples/test-suite/nested_extend_c.i
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
%module nested_extend_c
|
||||
|
||||
%extend hiA {
|
||||
hiA() {
|
||||
union hiA *self = (union hiA *)malloc(sizeof(union hiA));
|
||||
self->c = 'h';
|
||||
return self;
|
||||
}
|
||||
char hi_extend() {
|
||||
return $self->c;
|
||||
}
|
||||
}
|
||||
%extend lowA {
|
||||
lowA() {
|
||||
struct lowA *self = (struct lowA *)malloc(sizeof(struct lowA));
|
||||
self->name = 0;
|
||||
self->num = 99;
|
||||
return self;
|
||||
}
|
||||
int low_extend() {
|
||||
return $self->num;
|
||||
}
|
||||
}
|
||||
|
||||
%extend hiB {
|
||||
hiB() {
|
||||
union hiB *self = (union hiB *)malloc(sizeof(union hiB));
|
||||
self->c = 'h';
|
||||
return self;
|
||||
}
|
||||
char hi_extend() {
|
||||
return $self->c;
|
||||
}
|
||||
}
|
||||
%extend lowB {
|
||||
lowB() {
|
||||
struct lowB *self = (struct lowB *)malloc(sizeof(struct lowB));
|
||||
self->name = 0;
|
||||
self->num = 99;
|
||||
return self;
|
||||
}
|
||||
int low_extend() {
|
||||
return $self->num;
|
||||
}
|
||||
}
|
||||
|
||||
%inline %{
|
||||
typedef struct NestedA {
|
||||
int a;
|
||||
union hiA {
|
||||
char c;
|
||||
int d;
|
||||
} hiA_instance;
|
||||
|
||||
struct lowA {
|
||||
char *name;
|
||||
int num;
|
||||
} lowA_instance;
|
||||
} NestedA;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
union hiB {
|
||||
char c;
|
||||
int d;
|
||||
} hiB_instance;
|
||||
|
||||
struct lowB {
|
||||
char *name;
|
||||
int num;
|
||||
} lowB_instance;
|
||||
} NestedB;
|
||||
%}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue