jhass / crystal-gobject

gobject-introspection for Crystal
BSD 3-Clause "New" or "Revised" License
127 stars 13 forks source link

Can't generate bindings for libgee-0.8 #31

Closed aljelly closed 4 years ago

aljelly commented 4 years ago

Tried to generate bindings for Gee:

require_gobject("Gee")

Results in:

There was a problem expanding macro 'require_gobject'

Code in src/gtk-test.cr:5:1

 5 | require_gobject("Gee")
     ^
Called macro defined in lib/gobject/src/gobject.cr:7:1

 7 | macro require_gobject(namespace)

Which expanded to:

 > 1193 | get_remaining_capacity : -> Void
 > 1194 | get_is_full : -> Void
 > 1195 | UNBOUNDED_CAPACITY = -1 # : Int32
          ^
Error: expecting identifier 'end', not 'UNBOUNDED_CAPACITY'

It seems to generate an invalid struct:

 > 1186 |   struct Queue # interface
 > 1187 |     parent_iface : LibGObject::TypeInterface
 > 1188 |     offer : -> Void
 > 1189 |     peek : -> Void
 > 1190 |     poll : -> Void
 > 1191 |     drain : -> Void
 > 1192 |     get_capacity : -> Void
 > 1193 |     get_remaining_capacity : -> Void
 > 1194 |     get_is_full : -> Void
 > 1195 |     UNBOUNDED_CAPACITY = -1 # : Int32
 > 1196 |   # Requires Collection
 > 1197 |     # Virtual function offer
 > 1198 |     # Virtual function peek
 > 1199 |     # Virtual function poll
 > 1200 |     # Virtual function drain
 > 1201 |     # Virtual function get_capacity
 > 1202 |     # Virtual function get_remaining_capacity
 > 1203 |     # Virtual function get_is_full
 > 1204 |     # Property capacity : Int32
 > 1205 |     # Property remaining_capacity : Int32
 > 1206 |     # Property is_full : Bool
 > 1207 |   end
aljelly commented 4 years ago

Relevant:

https://github.com/GNOME/libgee/blob/2b646cc0a3ec9b84555ded92a7bd2bc053ac3890/gee/queue.vala#L52

Seems to be incorrectly handling this const.