Skip to content

Commit

Permalink
add support for unexposed type definitions
Browse files Browse the repository at this point in the history
desperately need tests.
  • Loading branch information
tjfontaine committed Mar 18, 2014
1 parent 4dd7b37 commit 5ad34dc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/generateffi.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,20 @@ exports.generate = function (opts) {
} else if (this.kind == Cursor.FieldDecl && this.type.kind == Type.Unexposed) {
//console.error('FieldDecl', this.type.kind, this.type.spelling);
t = wrap.elements[wrap.elements.length - 1];
t.name = this.spelling;
return Cursor.Continue;
/* This may not be entirely correct, we're assuming that because we
* already have elements defined that we're at the name of it,
* consider `union { int foo; } myUnion;` but it's also possible
* we are at an actual definition and we should be defining this type
*
* TODO -- man I need tests.
*/
if (t) {
t.name = this.spelling;
return Cursor.Continue;
} else {
t = defineType(this.type.declaration);
tname = this.spelling;
}
} else {
t = mapType(this.type, this.spelling);
tname = this.spelling;
Expand Down

0 comments on commit 5ad34dc

Please sign in to comment.